摘要: http://www.notonlysuccess.com/index.php/segment-tree-complete/#include#include#include#include#define lson l,m,rt>1; build(lson); build(rson); ... 阅读全文
posted @ 2014-09-10 17:51 JarvisLau 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 在刷线段树,参考自http://www.notonlysuccess.com/index.php/segment-tree-complete/#include#include#include#define lson l,m,rt>1; build(lson); build(rson); ... 阅读全文
posted @ 2014-09-10 12:22 JarvisLau 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 将e按从大到小排序,统计前i-1个中比#include#include#include#includeusing namespace std;struct Item{ int s; int e; int x;};int n;Item item[500010];int a[50001... 阅读全文
posted @ 2014-09-09 21:19 JarvisLau 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;int a[1300][1300];int s;int lowbit(int x){ return x&(-x);}void add(int x,int y,int d){ for(in... 阅读全文
posted @ 2014-09-05 20:11 JarvisLau 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 求逆序数#include#include#include#includeusing namespace std;struct node{ int num; int pos;};node st[500010];int reflect[500010];int a[500010];int n;... 阅读全文
posted @ 2014-09-04 22:14 JarvisLau 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#includeusing namespace std;int a[1000][1000];int n;struct Item{ int jx,sum; bool operator a.sum; }};void sol... 阅读全文
posted @ 2014-09-03 17:50 JarvisLau 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;struct st{ int QNum,Period,time; bool operator a.time||(time==a.time&&QNum>a.QNum); }... 阅读全文
posted @ 2014-09-03 13:21 JarvisLau 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 参考自http://www.cnblogs.com/maqiang/archive/2012/05/02/2479760.html#include #include #include #include #include #include using namespace std;struct st{ ... 阅读全文
posted @ 2014-09-02 14:12 JarvisLau 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度为O(n),参考:http://bbs.dlut.edu.cn/bbstcon.php?board=Competition&gid=23474#include#include#include#include#define maxn 2001000using namespace std;ch... 阅读全文
posted @ 2014-08-23 12:21 JarvisLau 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 注意处理溢出#include#include#include#includeusing namespace std;long long n;long long a[60][2];int k;int fun(long long y,int x){ long long cnt=0,cur=1; ... 阅读全文
posted @ 2014-08-21 17:33 JarvisLau 阅读(159) 评论(0) 推荐(0) 编辑