摘要: 线段树的区间合并入门题 1 #include 2 #include 3 using namespace std; 4 const int MAXN=50001=r){33 msum[rt]=lsum[rt]=rsum[rt]=c*(r-l+1);34 la[rt]... 阅读全文
posted @ 2014-08-07 16:37 Mr.XuJH 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 树状数组+素数打表 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const int maxn=10000100; 8 const int maxm=1000010; 9 in... 阅读全文
posted @ 2014-08-07 14:26 Mr.XuJH 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 树状数组求逆序数。我们先把所有的道路按照X升序,X相同时Y升序的方法排列。这样从头至尾便利,对于每条道路,我们只需要知道它之前有多少道路的Y大于它的Y就 可以了,所以我们只要知道前面有多少Y小于等于它的再用下标减去就可以了。#include #include #include #include us... 阅读全文
posted @ 2014-08-07 13:20 Mr.XuJH 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 用树状数组把HDU1166再写了一次 感觉树状数组简洁 1 #include 2 #include 3 #include 4 using namespace std; 5 int c[50002],lv[50002],n; 6 int lowbit(int x){return x&(-x);}... 阅读全文
posted @ 2014-08-07 10:17 Mr.XuJH 阅读(105) 评论(0) 推荐(0) 编辑