tarjan
箱@子
这个作者很懒,什么都没留下…
展开
-
HDU - 4612 Warm up (tarjan缩点 + 树形dp)
N planets are connected by M bidirectional channels that allow instant transportation. It's always possible to travel between any two planets through these channels. If we can isolate some planets ...原创 2020-04-01 22:26:21 · 139 阅读 · 0 评论 -
HDU - 4738 Caocao's Bridges (tarjan找桥)
在赤壁之战中,曹操被诸葛亮和周瑜击败。但他不会放弃。曹操的军队仍然不善于水战,所以他提出了另一个想法。他在长江建造了许多岛屿,在这些岛屿的基础上,曹操的军队很容易攻击周瑜的部队。曹操还建造了连接岛屿的桥梁。如果所有岛屿都通过桥梁相连,那么曹操的军队可以在这些岛屿中非常方便地部署。周瑜无法忍受,所以他想要摧毁一些曹操的桥梁,这样一个或多个岛屿就会与其他岛屿分开。但周瑜只有一枚由诸葛亮留下的炸弹,所...原创 2020-03-31 21:57:37 · 170 阅读 · 0 评论 -
HDU - 3861 The King’s Problem
In the Kingdom of Silence, the king has a new problem. There are N cities in the kingdom and there are M directional roads between the cities. That means that if there is a road from u to v, you can o...原创 2019-12-07 17:02:29 · 131 阅读 · 0 评论 -
HDU - 1827 Summer Holiday 强联通缩点 + 贪心
Summer HolidayTime Limit: 10000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6068Accepted Submission(s): 2607Problem DescriptionTo see a World in...原创 2019-11-20 19:52:46 · 112 阅读 · 0 评论 -
迷宫城堡 HDU - 1269 初学tarjan
迷宫城堡HDU - 1269为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是否任意两个房间都是相互连通的,即:对于任意的i和j...原创 2019-09-04 21:12:30 · 162 阅读 · 0 评论 -
洛谷P3388 【模板】割点(割顶)
输入输出样例输入 #1复制6 71 21 31 42 53 54 55 6输出 #1复制1 5说明/提示对于全部数据,n \le 20000n≤20000,m \le 100000m≤100000点的编号均大于00小于等于nn。tarjan图不一定联通。一道tarjan求割点的裸题#include<bits/stdc++.h&...原创 2019-09-08 20:24:42 · 127 阅读 · 0 评论 -
洛谷P3387 【模板】缩点 tarjan + 拓扑排序解决dp无后效性
需要用拓扑排序解决dp的无后效性#include<bits/stdc++.h>using namespace std;const int maxn = 1e5 + 10;int head[maxn];int dfn[maxn];int low[maxn];bool vis[maxn];int colour[maxn];int dv[maxn];int ind...原创 2019-09-09 11:06:59 · 207 阅读 · 0 评论 -
Redundant Paths POJ - 3177 and Road Construction POJ - 3352 无向图缩点
以下是两题的链接:https://vjudge.net/problem/POJ-3177https://vjudge.net/problem/POJ-3352这两题其实是差不多的 3177有重边得去重下面贴上我的代码#include<iostream>#include<cstring>#include<stack>#include&l...原创 2019-09-11 16:14:00 · 114 阅读 · 0 评论