| 2 | #include<vector> |
| 3 | using namespace std; |
| 4 | void dfs(int node, int parent, vector<int> &vis, vector<int> &tin, vector<int> &low, int &timer, vector<int> adj[]) |
| 5 | { |
| 6 | tin[node] = low[node] = timer++; |
| 7 | for(auto it : adj[node]) |
| 8 | { |
| 9 | if(it == parent) |
| 10 | continue; |
| 11 | if(!vis[it]){ |
| 12 | dfs(it, node, vis, tin, low, timer, adj); |
| 13 | low[node] = min(low[node], low[it]); |
| 14 | if(low[it] > tin[node]) |
| 15 | cout << node << " " << it << endl; |
| 16 | } |
| 17 | else |
| 18 | low[node] = min(low[node], tin[it]); |
| 19 | } |
| 20 | } |
| 21 | int main() |
| 22 | { |
| 23 | int n, m; |