[백준][Python] 7511 소셜네트워킹

[백준][Python] 7511 소셜네트워킹

마지막 비교때 parent[v]==parent[u]로 썼다가 한참 틀렸다. 부모는 한칸위고 find가 루트를 찾는거라 find비교를 했어야했는데 두개의 차이에 대해 고민을 안해봤던 것 같아서 이런 문제가 생겼던 것같다. 오늘 확실히 알고간다.

import sys input = sys.stdin.readline def union(a,b): #집합이 다를경우 합침 a=find(a) b=find(b) if a

from http://devlibrary00108.tistory.com/188 by ccl(A) rewrite - 2021-08-05 09:26:49