上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页
摘要: 题意:依次找第i大的数下标pos[i],然后将区间[i,pos[i]]翻转分析:splay树区间翻转// File Name: ACM/HDU/1890.cpp// Author: Zlbing// Created Time: 2013年08月10日 星期六 20时26分39秒#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define CL(x,v); memset(x,v,sizeof(x));#defin 阅读全文
posted @ 2013-08-10 21:21 z.arbitrary 阅读(567) 评论(0) 推荐(0) 编辑
摘要: 区间更新求和主要用来练习splay树区间更新问题//splay树的题解// File Name: 3468-splay.cpp// Author: Zlbing// Created Time: 2013年08月09日 星期五 16时30分32秒#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define CL(x,v); memset(x,v,sizeof(x));#define INF 0x3f3f3f3f# 阅读全文
posted @ 2013-08-10 16:59 z.arbitrary 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 题意:给出一个n个数的数列a,对于第i个元素ai定义fi=min(abs(ai-aj)),(1#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define CL(x,v); memset(x,v,sizeof(x));#define INF 0x3f3f3f3f#define LL long long#define REP(i,r,n) for(int i=r;i=r;i--)const int MAXN=200010;con 阅读全文
posted @ 2013-08-10 14:08 z.arbitrary 阅读(1305) 评论(0) 推荐(0) 编辑
摘要: 这个题也是单点维护,不管来的是人还是狗,只要num=0就插入,否则就删除。// File Name: ACM/bzoj/1208.cpp// Author: Zlbing// Created Time: 2013年08月08日 星期四 16时33分53秒#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define CL(x,v); memset(x,v,sizeof(x));#define INF 0x3f3f 阅读全文
posted @ 2013-08-10 11:00 z.arbitrary 阅读(487) 评论(0) 推荐(0) 编辑
摘要: http://www.lydsy.com/JudgeOnline/problem.php?id=1503用w值记录它的加减情况,加(减)操作加在w上加(减)val,当新来一个的时候你插入树中应该是以前工资未变化时的相对值,也就是val-w// File Name: ACM/bzoj/1503.cpp// Author: Zlbing// Created Time: 2013年08月08日 星期四 14时29分46秒#include#include#include#include#include#include#include#include#include#include#include#in 阅读全文
posted @ 2013-08-09 15:15 z.arbitrary 阅读(1851) 评论(0) 推荐(0) 编辑
摘要: 题意:给N个点,M条边。有些边的距离是精确的,有些边的距离是不精确的(>=1)分析对于 a-b==t的边可以建边a=1的边可以建边b#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define CL(x,v); memset(x,v,sizeof(x));#define INF 0x3f3f3f3f#define LL long long#define REP(i,r,n) for(int i=r;i=r;i--)#de 阅读全文
posted @ 2013-08-06 10:50 z.arbitrary 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 题意:有一个序列,题目用n个整数组合 [ai,bi,ci]来描述它,[ai,bi,ci]表示在该序列中处于[ai,bi]这个区间的整数至少有ci个。如果存在这样的序列,请求出满足题目要求的最短的序列长度是多少。分析:dis[i]表示从0->i-1这i个数存在多少个数。则有dis[b+1]-dis[a]>=c;dis[i+1]-dis[i]>=0 && dis[i+1]-dis[i]#include#include#include#include#include#include#include#include#include#include#includeusi 阅读全文
posted @ 2013-08-05 16:38 z.arbitrary 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 题意:在有向加权图中G(V,E),邮局要从起点S向其他n个节点发送邮件,于是派出n个邮递员,分别到达其他n个地点发送,然后回到起点S,求出所有邮递员所经过的总路程的最小值。分析:正向一次dijkstra,反向一次dijkstra// File Name: 2008.cpp// Author: Zlbing// Created Time: 2013年08月04日 星期日 14时18分49秒#include#include#include#include#include#include#include#include#include#include#include#includeusing nam 阅读全文
posted @ 2013-08-05 15:21 z.arbitrary 阅读(365) 评论(5) 推荐(0) 编辑
摘要: 题意:求第K 大连续区间分析:二分答案,再n * log(n)判断有几个区间的区间和大于mid,然后调整上下界,使这个值不断的接近k。判断符合条件的区间总数:线性扫描sum[n](前n项和) 每次判断以i结尾的区间有几个区间和大于等于mid,累加即可// File Name: 191-E.cpp// Author: Zlbing// Created Time: 2013年08月03日 星期六 15时10分13秒#include#include#include#include#include#include#include#include#include#include#include#incl 阅读全文
posted @ 2013-08-04 16:40 z.arbitrary 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 题意:有N 个点,M条边,加一条边,求割边最少。(有重边)分析:先求双连通分量,缩点形成一个生成树,然后求这个的直径,割边-直径即是答案因为有的图上可能有重边,这样不好处理。我们记录每条边的标号(一条无向边拆成的两条有向边标号相同)这样就能限制不走一样的边而能走重边!// File Name: 1002.cpp// Author: Zlbing// Created Time: 2013年08月02日 星期五 18时16分10秒#pragma comment(linker,"/STACK:102400000,102400000")#include#include#includ 阅读全文
posted @ 2013-08-04 11:26 z.arbitrary 阅读(1390) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页