Codeforces Round #260 (Div. 1) C. Civilization(dfs+并查集)

NoSuchKey