【模板】权值线段树
摘要:#define lc(x) (x<<1) #define rc(x) (x<<1|1) struct tree { int num; int l, r; }node[maxn]; inline void build(int x, int l, int r) { node[x].num = 0; no
阅读全文
posted @
2019-12-04 14:34
thjkhdf12
阅读(178)
推荐(0)
【codeforces 19/11/13 div2】D. Yet Another Monster Killing Problem
摘要:1 #include<iostream> 2 #include<vector> 3 #include<algorithm> 4 #include<cstring> 5 #include<cstdio> 6 using namespace std; 7 8 const int INF = 0x3f3f
阅读全文
posted @
2019-11-14 14:45
thjkhdf12
阅读(161)
推荐(0)
【ICPC Aisa Yinchuan, 线段树(max,add)】G.Pot!!
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-26 14:16
thjkhdf12
阅读(196)
推荐(0)
【线段树(sum,add)】P1083 借教室
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-23 11:27
thjkhdf12
阅读(104)
推荐(0)
【线段树】P2023 [AHOI2009]维护序列
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-14 17:45
thjkhdf12
阅读(101)
推荐(0)
【线段树】P1198 [JSOI2008]最大数
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-11 20:25
thjkhdf12
阅读(106)
推荐(0)
【树状数组】P1972 [SDOI2009]HH的项链
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-11 14:36
thjkhdf12
阅读(137)
推荐(0)
【模板】树状数组
摘要:int n; const int maxn = 100010; int a[maxn]; int sum1[maxn]; int sum2[maxn]; inline int lowbit(int x) { return x & (-x); } inline void updata(int i, int k) { int x = i; while (i <= n) { sum1[i] += k;
阅读全文
posted @
2019-10-11 13:30
thjkhdf12
阅读(130)
推荐(0)
【模板】线段树(min,add)
摘要:const int maxn = 5000010; int a[maxn]; #define lc(x) x<<1 #define rc(x) x<<1|1 il int min(int a, int b) { return a > b ? b : a; } struct tree { int a;
阅读全文
posted @
2019-10-11 13:06
thjkhdf12
阅读(160)
推荐(0)