그냥 성별조건 추가된 크루스칼 import sys input = sys.stdin.readline def find(x): if parent[x] == x: return x parent[x] = find(parent[x]) return parent[x] def union(a,b): a = find(a) b = find(b) if level[a] >= level[b]: parent[b] = a if level[a]==level[b]: level[a] +=1 else: parent[a] = b N, M = map(int, input().split()) sex = [0] + list(input().split()) arr = [] parent = {i:i for i in range(1,N+1)} level = {..