집단을 나눠full-fill 하고 확장. 확장 시킬때마다 각 자리의 거리정보를 갱신 import sys from collections import deque, defaultdict input = sys.stdin.readline def find_continent(x, y): q = deque() q.append((x, y)) matrix[x][y] = numbering while q: x, y = q.popleft() for dx, dy in delta: nx, ny = x + dx, y + dy if 0