摘要:
1 #include 2 using namespace std; 3 int n; 4 int a[1010],t[1010],w[1010]; 5 int dp[200010]; 6 struct node 7 { 8 int l,r,value; 9 }num[100010]; 10 int cmp(node x,node y) 11 { 12 if(x... 阅读全文
摘要:
1 nth_element(a+1 , a + m, a + n+1); 2 nth_element(first , mth, end); 3 区间【first,end)以第m个数为分界线前面都小,后面都大 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 const int N = 1Q[i].l) 58 { 59 L--; 60 add(L-1); 61 } 62 while(RQ[i].r) 68 { 69 del(R);... 阅读全文
摘要:
题目描述 White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The plant in the j-th column of the i-th row belong 阅读全文
摘要:
题目描述 White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The plant in the j-th column of the i-th row belong 阅读全文
摘要:
现在有一个n个元素的数组a,而他要对a[L]-a[R]进行M次操作: 操作一:将a[L]-a[R]内的元素都加上P 操作二:将a[L]-a[R]内的元素都减去P 最后询问a[l]-a[r]内的元素之和? n,m <= 1e6 1 #include <iostream> 2 #include <cst 阅读全文
摘要:
1 链接:https://www.nowcoder.com/acm/contest/141/C 2 来源:牛客网 3 4 Eddy likes to play cards game since there are always lots of randomness in the game. For most of the cards game, the very first step ... 阅读全文
摘要:
链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 题目描述 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., 阅读全文
摘要:
Chiaki has an array of n positive integers. You are told some facts about the array: for every two elements ai and aj in the subarray al..r (l≤i<j≤r), 阅读全文
摘要:
线段树构造 因为树状数组不需要构造这一过程,所以先讲线段树的构造 就是用到递归:先设left=1,right=n,然后每一次递归,left、mid和mid+1、right。代码如下: `` 线段树单点修改 单点修改就是每到一个节点,看这个节点代表着的区间包括不包括这个点,包括就加上。 树状数组单点修 阅读全文