문제는 여기! #include using namespace std; int N, M; int MAP[501][501]; bool isVisited[501]; int answer = 0; void solve(){ queue q; isVisited[1] = true; for(int i=1; i N >> M; for(int i=0; i> x >> y; MAP[x][y] = 1; MAP[y][x] = 1; } } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); input(); solve(); cout