上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页
摘要: 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... 阅读全文
posted @ 2018-08-07 19:30 TTTCoder 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 nth_element(a+1 , a + m, a + n+1); 2 nth_element(first , mth, end); 3 区间【first,end)以第m个数为分界线前面都小,后面都大 阅读全文
posted @ 2018-08-04 20:09 TTTCoder 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 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);... 阅读全文
posted @ 2018-08-02 21:03 TTTCoder 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 题目描述 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 阅读全文
posted @ 2018-07-28 08:10 TTTCoder 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题目描述 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 阅读全文
posted @ 2018-07-28 07:58 TTTCoder 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 现在有一个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 阅读全文
posted @ 2018-07-27 21:08 TTTCoder 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 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 ... 阅读全文
posted @ 2018-07-26 20:55 TTTCoder 阅读(307) 评论(1) 推荐(0) 编辑
摘要: 链接: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), ..., 阅读全文
posted @ 2018-07-25 11:19 TTTCoder 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 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), 阅读全文
posted @ 2018-07-24 21:04 TTTCoder 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 线段树构造 因为树状数组不需要构造这一过程,所以先讲线段树的构造 就是用到递归:先设left=1,right=n,然后每一次递归,left、mid和mid+1、right。代码如下: `` 线段树单点修改 单点修改就是每到一个节点,看这个节点代表着的区间包括不包括这个点,包括就加上。 树状数组单点修 阅读全文
posted @ 2018-07-21 10:25 TTTCoder 阅读(1150) 评论(0) 推荐(2) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页