집합의 표현
[골5] 1717 - 집합의 표현
#include #include #include #pragma region 빠른 입출력 #define FAST_IO() \ {\ ios::sync_with_stdio(false);\ cin.tie(NULL); \ cout.tie(NULL); \ }\ #pragma endregion using namespace std; int graph[1000001]; int GetParent(int x) { if (graph[x] == x) return x; else return graph[x] = GetParent(graph[x]); } void Union(int a, int b) { a = GetParent(a), b = GetParent(b); graph[a] = b; } void Find(int a, int b..