[프로그래머스] 전력망을 둘로 나누기(C++)
·
개발/알고리즘
문제 링크https://school.programmers.co.kr/learn/courses/30/lessons/86971 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 코드 구현#include #include #include #include using namespace std;vector> tree;vector visited;int nodeCount = 0;void dfs(int node){ nodeCount++; for (const auto& neighbor : tree[node]) { if (!visited[neighbor]) { vi..