摘要: [模板题]https://www.luogu.com.cn/problem/P3128 在(u,v)最短路径上每个点加上v,询问最后权值最大的点 const int N = 5e4 + 50,M = 1e5 +50; int h[N],e[M],ne[M],idx; void add(int a,i 阅读全文
posted @ 2021-09-07 01:16 LaiYiC 阅读(16) 评论(0) 推荐(0) 编辑
摘要: [模板]https://www.luogu.com.cn/problem/P3379 const int N = 5e5 + 50,M = 1e6 +50; int h[N],e[M],ne[M],idx; void add(int a,int b) { e[idx]=b,ne[idx]=h[a], 阅读全文
posted @ 2021-09-06 20:29 LaiYiC 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 题意:逆时针绕圈,问最长怎么走 https://vjudge.net/problem/POJ-1696 int sgn(double x) { if(fabs(x) < eps)return 0; else return x<0?-1:1; } struct Point { double x,y; 阅读全文
posted @ 2021-08-27 15:14 LaiYiC 阅读(33) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1807 int n,m; int h[N],e[N],ne[N],w[N],idx; void add(int a,int b,int c) { e[idx]=b,w[idx]=c,ne[idx]=h[a],h[a]=idx++; 阅读全文
posted @ 2021-08-26 11:43 LaiYiC 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 1.时间戳 int dfn[N],vis[N],cnt; void dfs(int u) { vis[u]=1; dfn[u]=++cnt;//时间戳 for(int i=h[u]; ~i; i=ne[i]) { int j=e[i]; if(vis[j])continue; dfs(j); } } 阅读全文
posted @ 2021-08-26 00:26 LaiYiC 阅读(33) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P3000 最多删除k条边使得树的直径最小 二分答案,dfs的时候考虑结点u,now记录u的已经遍历的儿子的最大深度,len[j]表示j的最大深度,如果now + len[j] >= mid,把now那条边和j边 长的切断,更新now 阅读全文
posted @ 2021-08-25 23:23 LaiYiC 阅读(53) 评论(0) 推荐(0) 编辑
摘要: int sgn(double x) { if(fabs(x) < eps)return 0; else return x<0?-1:1; }; struct Point {double x,y;}; double Distance(Point A,Point B) {return hypot(A.x 阅读全文
posted @ 2021-07-29 01:39 LaiYiC 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 动态凸包,n次操作,添加一个点,或询问一个点是否在凸包内部. ps:询问每次更新后的凸包面积的板子在Hdu板子上. typedef long long ll; const int MOD = 1e9 + 7; const int INF = 0x7fffffff; const double eps 阅读全文
posted @ 2021-07-28 23:56 LaiYiC 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 凸包内最大三角形 #define ld double const ld eps = 1e-9; const ld PI =acos(-1); const int N = 2e5 + 50; int sgn(double x) { if(fabs(x) < eps)return 0; return x 阅读全文
posted @ 2021-07-28 19:04 LaiYiC 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 解决从某一状态到另一状态,状态很大 1.八数码https://www.acwing.com/problem/content/181/ 问最少步数将 23415x768 → 12345678x.九宫格移动,x为空格 #include<unordered_map> #define PII pair<in 阅读全文
posted @ 2021-07-24 15:09 LaiYiC 阅读(35) 评论(0) 推荐(0) 编辑