摘要: 题目传送门 1 /* 2 线段树-成段更新:第一题!只要更新区间,输出总长度就行了 3 虽然是超级裸题,但是用自己的风格写出来,还是很开心的:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #incl... 阅读全文
posted @ 2015-05-15 20:56 Running_Time 阅读(124) 评论(0) 推荐(0)
摘要: 题目传送门 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int MAX_N = 100000 + 10; 7 int cnt[MAX_N]; 8 int ans[MAX_N]; 9 in... 阅读全文
posted @ 2015-05-15 18:28 Running_Time 阅读(121) 评论(0) 推荐(0)
摘要: 题目传送门 1 #include 2 #include 3 #define lson l, m, rt > 1 % 5 == 3)12 sum[rt] += sum[rt >> 1];13 if (rt >>1 | 1 % 5 == 3)14 sum[rt... 阅读全文
posted @ 2015-05-15 18:08 Running_Time 阅读(166) 评论(0) 推荐(0)
摘要: 题目传送门 1 #include 2 #include 3 #define lson l, m, rt > 1;23 build (lson);24 build (rson);25 }26 27 int update(int p, int l, int r, int rt)28 ... 阅读全文
posted @ 2015-05-15 18:03 Running_Time 阅读(135) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 结点存储下面有几个空位 3 每次从根结点往下找找到该插入的位置, 4 同时更新每个节点的值 5 */ 6 #include 7 #define lson l, m, rt > 1;21 build (lson);22 build (... 阅读全文
posted @ 2015-05-15 17:47 Running_Time 阅读(119) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 主要利用线段树求区间最值,sum[]代表位置可用空间 3 每次找到最大值的位置 4 功能:查询最靠前能容纳广告的位置 5 */ 6 #include 7 #include 8 #include 9 #define lson l, m, rt >... 阅读全文
posted @ 2015-05-15 17:36 Running_Time 阅读(119) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 线段树基本功能:区间最大值,修改某个值 3 */ 4 #include 5 #include 6 #include 7 #define lson l, m, rt > 1;32 build (lson);33 build (rson);34 ... 阅读全文
posted @ 2015-05-15 17:30 Running_Time 阅读(167) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 线段树基本功能:区间值的和,修改某个值 3 */ 4 #include 5 #include 6 #define lson l, m, rt > 1;25 build (lson);26 build (rson);27 pushup (r... 阅读全文
posted @ 2015-05-15 17:06 Running_Time 阅读(152) 评论(0) 推荐(0)