摘要:
cf555e(缩点) 给一个 n 个点 m 条边的图,以及 q 对点 (s,t),让你给 m 条边定向。问是否存在一种方案,使每对点的 s 能走到 t。 $n,m,q≤ 2×10^5$. 首先,在一个边双内,一定存在一种定向方案,使得边双内点两两可达。(考虑桥) 因此,可以直接把边双缩点。然后树上差 阅读全文
摘要:
ARC102D(构造) 构造一个图,使得$n \le 20,m\le 60$,边从小的点连向大的点,并且从1到n的所有路径,长度与$[0, l 1]$构成双射。 用二进制的思想……代码很鬼畜 c++ include using namespace std; const int maxn=25; in 阅读全文
摘要:
Elaxia的路线 求无向图中,两对点间最短路的最长公共路径。 四遍spfa标出每条边的标记,然后用拓扑排序跑dp即可。 exp:拓扑排序可以跑DAG上的dp。 c++ include include include using namespace std; const int maxn=1505; 阅读全文
摘要:
Sessions in BSU 有n项考试。每项考试给定两个时间,你可以任意选择一个时间。每个时间点只能考一场考试,请问在最优情况下最早考完的时间。n include include using namespace std; typedef pair pi; const int maxn=2e6+5 阅读全文
摘要:
Mouse Hunt 给定一个n个点的图,每个点有权值$c_i$,并且只有一条出边。现在你要在一些点上打标记,使得从任何一个点出发最终都会经过有标记的点。求标记点的权值和最小值。 就是找环啊!拓扑排序啊! c++ include include using namespace std; const 阅读全文