목록단절점과 단절선 (1)
레야몬
[C++] 11400번 단절선 - 그래프 이론, 그래프 탐색, DFS, 단절점과 단절선
#include #include #include #define FOR(i, k, N) for(int i=k; i> V >> E; FOR(i, 1, E) { int a, b; cin >> a >> b; Vertex[a].push_back(b); Vertex[b].push_back(a); } } int dfs(int no, int par) { discovered[no] = ++cnt; //발견된 순서(1부터 시작) int ret = discovered[no]; FOR(i, 1, Vertex[no].size()) { int next = Vertex[no][i-1]; //탐색할 노드 if(next == par) continue; if(!discovered[next]) { //탐색이 아직 되지 않았으면 int s..
알고리즘/백준
2022. 10. 17. 21:29