-
[벡준] 2887번: 행성 터널 - 파이썬(python)
틀린 풀이 import heapq def find_parent(parent, x) : if parent[x] != x : parent[x] = find_parent(parent, parent[x]) return parent[x] def union_parent(parent, i,j) : a = find_parent(parent, i) b = find_parent(parent, j) if a < b : parent[b] = a else : parent[a] = b N = int(input()) arr = [] q = [] parent = [i for i in range(N)] for _ in range(N) : x,y,z = map(int, input().split()) arr.append((x,y,z)) ..
알고리즘/Graph 그래프
2022. 10. 21.