dfs

    [다시풀기] (백준 2606) 바이러스

    알고리즘 DFS [문제 본문] 더보기 HTML 삽입 미리보기할 수 없는 소스 [푼 코드] #include #include #include using namespace std; int N, M; vector v[1001]; bool visit[1001] = {false}; int cnt = -1 ; void ResetVisit() { for (int i = 1; i > N >> M; int a, b; for (int i = 0; i > a >> b; v[a].push_back(b); v[b].push_back(a); } ResetVisit(); DFS(1); cout

    [다시풀기] (백준 1260) DFS와 BFS

    알고리즘 DFS, BFS [문제 본문] 더보기 HTML 삽입 미리보기할 수 없는 소스 [푼 코드] #include #include #include #include using namespace std; int N, M,V; vector v[1001]; bool visit[1001] = {false}; void ResetVisit() { for (int i = 1; i > V; int a, b; for (int i = 0; i > a >> b; v[a].push_back(b); v[b].push_back(a); } for (int i = 1; i