[c++] ํ๋ก๊ทธ๋๋จธ์ค - ์ฌํ๊ฒฝ๋ก(Level 3)
๋ฌธ์ ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ์ฌํ๊ฒฝ๋ก [["ICN", "SFO"], ["ICN", "ATL"], ["SFO", "ATL"], ["ATL", "ICN"], ["ATL","SFO"]] ["ICN", "ATL", "ICN", "SFO", "ATL", "SFO"] programmers.co.kr ์ฝ๋ #include #include #include #include #include #include using namespace std; struct Info{ string city; int index; }; unordered_mapgraph; bool flag = true; vectoranswer; int visited[10001]; void dfs(string now, int move, vectormemory, int..
2022. 5. 27.
[c++] ํ๋ก๊ทธ๋๋จธ์ค - ๊ฐ์ฅ ๋จผ ๋
ธ๋(Level 3)
๋ฌธ์ ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ๊ฐ์ฅ ๋จผ ๋
ธ๋ 6 [[3, 6], [4, 3], [3, 2], [1, 3], [1, 2], [2, 4], [5, 2]] 3 programmers.co.kr ์ฝ๋ #include #include #include #include #include #include using namespace std; vectorgraph[20001], dists; bool visited[20001]; int dist[20001]; int max_dist = -1; void bfs(int start){ queueq; q.push(start); visited[start] = 1; while(!q.empty()){ int x = q.front(); q.pop(); for(int next: graph[x]){..
2022. 5. 5.