Notice
Recent Posts
Recent Comments
Link
반응형
목록BFS (1)
변명은 만개 결과는 한개
[DFS, BFS 01]
더보기 https://www.acmicpc.net/problem/1260 #include #include #include #include using namespace std; vector v[1001]; bool visit[1001]; void bfs(int startIndex) { queue q; q.push(startIndex); visit[startIndex] = true; while (!q.empty()) { // 큐에 값이 있을 경우 계속 반복 // 큐에 값이 있다 -> 아직 방문하지 않은 노드가 존재함 int x = q.front(); q.pop(); printf("%d ", x); // x index 의 vec size(개수)만큼 훑음 for (size_t i = 0; i < v[x].siz..
공부/Problem Solving
2020. 6. 26. 02:20