AtCoder Beginner Contest 062 Solution

A Problem: Group the numbers 1 to 12 into sets: {1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}. Given two numbers, determine if they belong to the same group. Solution: This is essentially a connectivity problem, which can be solved using a union-find data structure. const int N = 14; int fa[N]; int find(int x) { return x == fa[x] ? x : fa[x] = fi ...

Posted on Sun, 25 Oct 2026 16:14:45 +0000 by damianraine