bfs로 대륙별 grouping한 후 행, 열 순회로 최소거리 측정하고 kruskal로 연결. 연결된 간선 n - 1개 미만이면 -1출력 import sys input = sys.stdin.readline from collections import deque from heapq import heappop, heappush def find(x): if parents[x] == x: return x parents[x] = find(parents[x]) return parents[x] def union(x, y): x = find(x) y = find(y) if x > y: x, y = y, x parents[y] = x def grouping_continent(x, y): q = deque() q.appen..