上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
摘要: 题意:找树上有多少对距离小于K的对数解析:树分治模板题,见注释 代码 #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<vector> using namespace std; typed 阅读全文
posted @ 2016-08-21 19:44 wust_ouyangli 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 解析:平面上的点分治,先递归得到左右子区间的最小值d,再处理改区间,肯定不会考虑哪些距离已经大于d的点对,对y坐标归并排序,然后从小到大开始枚举更新d,对于某个点,x轴方向只用考虑[x-d,x+d](x是分的中轴线),y轴方向只用考虑[y-d,y](y是这个点的y值),因为d值一直在变小,所以这个矩 阅读全文
posted @ 2016-08-21 19:31 wust_ouyangli 阅读(329) 评论(0) 推荐(0) 编辑
摘要: Problem Description ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的 阅读全文
posted @ 2016-08-17 16:48 wust_ouyangli 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Problem Description A school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new co 阅读全文
posted @ 2016-08-17 16:02 wust_ouyangli 阅读(149) 评论(0) 推荐(0) 编辑
摘要: dijkstral堆优化算法 struct node { int u,d; node(int u=0,int d=0):u(u),d(d){} bool operator < (const node& t) const{ return d>t.d; } }; struct edge { int u, 阅读全文
posted @ 2016-08-17 08:07 wust_ouyangli 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题意: 简化就是有两种操作,一种是插入(x,y,z)这个坐标,第二种是查询(x1,y1,z1)到(x2,y2,z2)(x1<=x2,y1<=y2,z1<=z2)的长方体包含多少个点。 解析: 将查询分成8个点,离线做,离散化z值,两次CDQ,第一次归并排x值,第二次归并排y值,z值用bit树维护更新 阅读全文
posted @ 2016-08-15 13:46 wust_ouyangli 阅读(437) 评论(0) 推荐(0) 编辑
摘要: Problem Description RD is a smart boy and excel in pinball game. However, playing common 2D pinball game for a great number of times results in accumu 阅读全文
posted @ 2016-08-12 10:57 wust_ouyangli 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 代码 //input(输入是先输N,再输N-1条边带权),调用dfs和Div,然后建线段树,更新每个点的值 //Find用于找两个点之间的最大值或其他,Update用于单点更新,如果成段更新于Find写得类似 #define tu nod[u] #define tv nod[v] #define e 阅读全文
posted @ 2016-08-11 08:39 wust_ouyangli 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 解析:增加三个变量lc(最左边的颜色),rc(最右边的颜色),sum(连续相同颜色区间段数)。然后就是区间合并的搞法。我就不详细解释了,估计你已经想到 如何做了。 代码 #include<cstdio> #include<cstring> #include<string> #include<vect 阅读全文
posted @ 2016-08-10 13:53 wust_ouyangli 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 代码 #include<cstdio> #include<cstring> #include<string> #include<vector> #include<algorithm> using namespace std; const int INF=1e9+7; const int maxn=3 阅读全文
posted @ 2016-08-10 09:49 wust_ouyangli 阅读(190) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页