MCPcopy Create free account
hub / github.com/atcoder/ac-library / main

Function main

test/example/dsu_practice.cpp:7–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace atcoder;
6
7int main() {
8 int n, q;
9 scanf("%d %d", &n, &q);
10 dsu d(n);
11 for (int i = 0; i < q; i++) {
12 int t, u, v;
13 scanf("%d %d %d", &t, &u, &v);
14 if (t == 0) {
15 d.merge(u, v);
16 } else {
17 if (d.same(u, v)) {
18 printf("1\n");
19 } else {
20 printf("0\n");
21 }
22 }
23 }
24 return 0;
25}

Callers

nothing calls this directly

Calls 2

mergeMethod · 0.80
sameMethod · 0.80

Tested by

no test coverage detected