392
392 基环树 P1399 [NOI2013] 快餐店
视频链接: // Luogu P1399 [NOI2013] 快餐店 #include<iostream> #include<algorithm> #inc…
【图论/基环树】AcWing 392. 会合
分析 这题就是一道需要分类讨论的图论。。 注意到题目中每个点只有一条出边,也就是说给出的图是一个内向的基环树森林。 首先进行预处理: 开一个并查集,这能够将两个点不在同一棵基环树的…
-->
视频链接: // Luogu P1399 [NOI2013] 快餐店 #include<iostream> #include<algorithm> #inc…
分析 这题就是一道需要分类讨论的图论。。 注意到题目中每个点只有一条出边,也就是说给出的图是一个内向的基环树森林。 首先进行预处理: 开一个并查集,这能够将两个点不在同一棵基环树的…