随笔分类 - 

摘要:https://www.luogu.org/problemnew/show/P2664 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #include<vector> 5 using namespace std; 6 # 阅读全文
posted @ 2018-12-30 20:53 hehe_54321 阅读(144) 评论(0) 推荐(0)
摘要:洛谷P5021 http://210.33.19.103/contest/1050/problem/3 http://210.33.19.103/contest/1054/problem/3 multiset版本(TLE) 1 #include<cstdio> 2 #include<algorith 阅读全文
posted @ 2018-11-17 10:33 hehe_54321 阅读(268) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/888/problem/G 这题可以用Boruvka算法: 一开始每个点是一个连通块。每次迭代对于每个连通块找到其最近邻居(与其有边相连且与其间最短边最短的连通块),然后将每个连通块和其最近邻居合并(选择的边自然是两连通块间最短边)。直到 阅读全文
posted @ 2018-10-31 10:24 hehe_54321 阅读(379) 评论(0) 推荐(0)
摘要:https://www.lydsy.com/JudgeOnline/problem.php?id=2125 http://www.tsinsen.com/ViewGProblem.html?gpid=-1000001268 题解 貌似还有一种仙人掌圆方树,跟点双圆方树区别不大,暂时不清楚有什么本质上 阅读全文
posted @ 2018-10-30 16:33 hehe_54321 阅读(150) 评论(0) 推荐(0)
摘要:https://www.luogu.org/problemnew/show/P2680 首先预处理出每个计划的原时间,然后把计划按时间从小到大排序 显然,最优方案一定是选某一个计划i,记路径集合S为i以及排序后在i后面的所有计划的路径,找出S中所有路径的交集(如果交集为空则无答案),取交集中所有边上 阅读全文
posted @ 2018-05-10 08:11 hehe_54321 阅读(219) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-04-18 21:09 hehe_54321 阅读(12) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-04-17 21:32 hehe_54321 阅读(4) 评论(0) 推荐(0)
摘要:错误记录:如下注释语句 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 typedef long long LL; 5 LL log2n=19,cnt=1; 6 LL anc[400010][20],maxv[400 阅读全文
posted @ 2018-02-24 16:40 hehe_54321 阅读(267) 评论(0) 推荐(0)
摘要:Fools and Roads CodeForces - 191C 题意:给出一棵n个节点的树,还有树上的k条简单路径(用路径的两个端点u和v表示),对于树上每一条边,求出其被多少条简单路径经过。 方法: 一开始想了很久..想要在倍增求lca的同时统计边经过的次数..然而发现这样子可以统计,但是统计 阅读全文
posted @ 2018-02-11 08:22 hehe_54321 阅读(279) 评论(0) 推荐(0)
摘要:树上最远点对(树的直径) 做法1:树形dp 最长路一定是经过树上的某一个节点的。 因此: an1[i],an2[i]分别表示一个点向下的最长链和次长链,次长链不存在就设为0;这两者很容易求 an3[i]表示i为根的子树中的答案;an3[u]=max(max{an3[v]}(v是u的子节点),an1[ 阅读全文
posted @ 2017-11-08 17:48 hehe_54321 阅读(339) 评论(0) 推荐(0)

AmazingCounters.com