DFS

· Algorithm
유형 난이도 완료일 링크 특이사항 DFS 실버1 23.4.8 https://www.acmicpc.net/problem/1991 내 코드 #include #include using namespace std; int n; int arr[26][26]; char p, c1, c2; int pk, c1k, c2k; char output; vector vec[26]; void Preorder(int node) { output = node+65; cout p >> c1 >> c2; pk = p-65; c1k = c1-65; c2k = c2-65; if(c1k>=0) { arr[pk][c1k] = 1; vec[pk].emplace_back(c1k); } else { vec[pk].emplace_back(-1); } ..
· Algorithm
유형 난이도 완료일 링크 특이사항 DFS, BFS 실버2 23/03/28 https://www.acmicpc.net/problem/1260 내 코드 #include #include #include using namespace std; int arr[1001][1001]; int visited[1001]; int visited2[1001]; int n, m, v; int cnt = 0; int cnt2 = 1; void DFS(int start) { cnt++; if(cnt>n) return; cout v1 >> v2; arr[v1][v2]=1; arr[v2][v1]=1; } visited[v]=1; DFS(v); cout
Yannoo
'DFS' 태그의 글 목록