
tarjan+lca
WA_automation
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
P1262 间谍网络 tarjan
https://www.luogu.org/problemnew/show/P1262 #include <bits/stdc++.h> using namespace std; const int maxN=3005; const int maxM=8005; const int INF=(1<<30); int head[maxN],tot,cs[maxN]; str...原创 2019-01-04 16:42:06 · 272 阅读 · 0 评论 -
HDU 1269
这是一个tarjan的模版题。我有个疑惑,看下面代码里的唯一一条注释。网上大都那么写,但这样写我总想不通到底有什么用,虽然两种写法都是对的,但是如果写成我这样的话,low值相同的点就在一个强联通分量中,不用开scc数组(看第二份代码) #include <iostream> #include <cstdio> #include <cstring> #includ...原创 2019-07-13 15:31:22 · 315 阅读 · 0 评论 -
hdu 1827
把一个强联通分量缩成一个点,点的话费是分量中所有点的话费的最小值,看新图中入度为0的点有多少个,把这些点的话费加起来就行 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <s...原创 2019-07-13 16:12:34 · 161 阅读 · 0 评论 -
hdu 3639
tarjan缩点,每个点的权值是点包含的人数,反向建图,选出当老鹰的一定是在入度为零的点中,跑一边dfs算入度为零的点可以到达的所有点的权值加起来是多少,加起来最大的就是了 注意去重边 #include <bits/stdc++.h> using namespace std; const int maxN=5e3+5; const int maxM=3e4+5; int N,M; in...原创 2019-07-14 10:30:01 · 280 阅读 · 0 评论 -
hdu 2586
lca看着篇文章,写的挺好的https://www.cnblogs.com/JVxie/p/4854719.html #include <bits/stdc++.h> using namespace std; const int maxN=4e4+5; const int maxM=2e2+5; int N,M,ans[maxM]; int vis[maxN],dis[maxN]; i...原创 2019-07-14 19:24:15 · 268 阅读 · 0 评论 -
2370 小机房的树
http://codevs.cn/problem/2370/ 一个lca的板子题,和我上一次写的一个差不多。 #include <bits/stdc++.h> using namespace std; const int maxN=5e4+5; const int maxM=8e4+5; int N,M,ans[maxM]; int pre[maxN],vis[maxN],dis[ma...原创 2019-07-15 11:29:57 · 177 阅读 · 0 评论 -
1036 商务旅行
http://codevs.cn/problem/1036/ 还是个lca的板子题,继续一贯的写法 #include <bits/stdc++.h> using namespace std; const int maxN=3e4+5; const int maxM=3e4+5; int N,M,ans[maxM]; int pre[maxN],vis[maxN],dis[maxN]; ...原创 2019-07-15 14:27:17 · 209 阅读 · 0 评论 -
POJ 1330
又是个lca的板子题,比我之前写的两个还要简单。。。 想起空间王者视频里那些评论:杀个人就发。。。 我做个题就发。。。 //#include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int ...原创 2019-07-17 10:12:29 · 254 阅读 · 0 评论