5567번

· 백준
코드 from collections import deque n = int(input()) m = int(input()) friend = [[] for _ in range(n+1)] for _ in range(m): x,y = map(int, input().split()) friend[x].append(y) friend[y].append(x) def bfs(x, graph): check = [0]*(n+1) queue = deque() queue.append(x) check[x] = 1 # 깊이를 체크해줄 것 cnt = 0 while queue: popnum = queue.popleft() if check[popnum] >= 3: break # 깊이가 3 이상이면 반복문 종료. 함수를 종료하는 것 X fo..