摘要: 裸线段树,目前WA中。如果用离散化的话,就跟poj 2528 Mayor’s posters一样中间需要插点,之前样例一直跑不对就是这个原因。但这个做法依然不对,我这种做法相当于默认为位运算的运算顺序不影响结果,实际上对于位运算来说,混合运算不同的运算顺序不一定得到相同的结果。虽然花了很长时间很大功夫也没做出来,但是知道自己错在哪里也是一种收获。 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 6 #define lson 阅读全文
posted @ 2013-05-09 23:23 冰鸮 阅读(383) 评论(6) 推荐(0)
摘要: 待编辑需一步思路转化 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 #define lson l, m, rt << 1 6 #define rson m + 1, r, rt << 1 | 1 7 8 const int MAXN = 200001; 9 10 int pos[MAXN], val[MAXN];11 int sum[MAXN << 2];12 int ans[MAXN];13 int N, id;14 15 void b 阅读全文
posted @ 2013-05-09 14:02 冰鸮 阅读(155) 评论(0) 推荐(0)
摘要: 线段树矩形周长并 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 6 #define lson l, m, rt << 1 7 #define rson m + 1, r, rt << 1 | 1 8 9 using namespace std; 10 11 struct Seg_Tree 12 { 13 int l, r, h, s; 14 Seg_Tree() {} 15 Seg_Tree( i 阅读全文
posted @ 2013-05-09 13:52 冰鸮 阅读(191) 评论(0) 推荐(0)
摘要: 求区间内最长连续上升子序列线段树典型区间合并 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 6 #define lson l, m, rt << 1 7 #define rson m + 1, r, rt << 1 | 1 8 9 using namespace std; 10 11 const int MAXN = 100010; 12 13 int N, Q; 14 int Lval[ MAX 阅读全文
posted @ 2013-05-09 00:35 冰鸮 阅读(164) 评论(0) 推荐(0)