This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
const int maxn = 1e5+7; | |
vector<int> ans, g[maxn]; | |
bool vis[maxn]; | |
void dfs(vector<int>p, int cur, int t) { | |
p.push_back(cur); | |
vis[cur] = 1; | |
if (cur == t) { | |
for (auto x:p) printf("%d ", x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 输出图中的所有的环 | |
//color label :white(not visited),black(all children have been visited),gray(start visiting node) | |
// if one edge direct to a gray node means has cycle. | |
#include <bits/stdc++.h> | |
using namespace std; | |
const int maxn = 1e5+3; | |
vector<int>g[maxn]; | |
int vis[maxn];//0 while,1 gray, 2 black | |
int fa[maxn]; |
NewerOlder