답안 #818394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
818394 2023-08-10T04:37:31 Z jophyyjh 분수 공원 (IOI21_parks) C++17
70 / 100
1192 ms 72204 KB
/**
 * (Just a test)
 * 
 * Time Complexity: O(n * log(n))       (Kruskal, bipartite graph, BFS, implementation)
 * Implementation 0.9               (Just a test)
*/

#include <bits/stdc++.h>
#include "parks.h"

typedef std::vector<int>    vec;

struct DSU {
    vec set, rank;
    DSU(int n) {
        set.resize(n);
        rank.resize(n);
        for (int k = 0; k < n; k++)
            set[k] = k, rank[k] = 1;
    }
    inline int find(int k) {
        if (set[k] == k)
            return k;
        return set[k] = find(set[k]);
    }
    bool merge(int a, int b) {
        a = find(a), b = find(b);
        if (a == b)
            return false;
        if (rank[b] > rank[a])
            std::swap(a, b);
        set[b] = a, rank[a] += rank[b];
        return true;
    }
};


struct pos_t {
    int x, y;
};

inline bool operator<(const pos_t& p1, const pos_t& p2) {
    return p1.x < p2.x || (p1.x == p2.x && p1.y < p2.y);
}

int construct_roads(vec x, vec y) {
    int n = x.size();
    std::map<pos_t, int> map;
    for (int k = 0; k < n; k++)
        map[{x[k], y[k]}] = k;
    
    DSU dsu(n);
    vec u(n - 1), v(n - 1);
    int ans_pt = 0;
    std::map<pos_t, vec> road_ls;
    for (int k = 0; k < n; k++) {
        for (int d = -1; d <= 1; d += 2) {
            pos_t new_pos = {x[k], y[k] + 2 * d};
            if (map.find(new_pos) == map.end())
                continue;
            int l = map[new_pos];
            if (dsu.merge(k, l)) {
                u[ans_pt] = k, v[ans_pt] = l;
                road_ls[{x[k] - 1, y[k] + d}].push_back(ans_pt);
                road_ls[{x[k] + 1, y[k] + d}].push_back(ans_pt);
                ans_pt++;
            }
        }
    }
    vec order(n);
    for (int i = 0; i < n; i++)
        order[i] = i;
    std::sort(order.begin(), order.end(),
              [&](int o1, int o2) {
                  return y[o1] > y[o2];
              });
    for (int k : order) {
        for (int d = -1; d <= 1; d += 2) {
            pos_t new_pos = {x[k] + 2 * d, y[k]};
            if (map.find(new_pos) == map.end())
                continue;
            int l = map[new_pos];
            if (dsu.merge(k, l)) {
                u[ans_pt] = k, v[ans_pt] = l;
                road_ls[{x[k] + d, y[k] + 1}].push_back(ans_pt);
                road_ls[{x[k] + d, y[k] - 1}].push_back(ans_pt);
                ans_pt++;
            }
        }
    }
    if (ans_pt < n - 1)
        return 0;
    assert(ans_pt == n - 1);

    vec bench_x(n - 1, -1), bench_y(n - 1, -1);
    std::queue<int> bfs_queue;
    for (int start = n - 2; start >= 0; start--) {
        if (bench_x[start] != -1)
            continue;
        int s_u = u[start], s_v = v[start];
        if (y[s_u] == y[s_v])       // horizontal
            bench_x[start] = (x[s_u] + x[s_v]) / 2, bench_y[start] = y[s_u] + 1;    // up
        else
            bench_x[start] = x[s_u] + 1, bench_y[start] = (y[s_u] + y[s_v]) / 2;
        bfs_queue.push(start);
        while (!bfs_queue.empty()) {
            int t = bfs_queue.front(), bx = bench_x[t], by = bench_y[t];
            bfs_queue.pop();
            assert(bx != -1 && by != -1);
            for (int nr : road_ls[{bx, by}]) {
                if (bench_x[nr] != -1)
                    continue;
                bench_x[nr] = x[u[nr]] + x[v[nr]] - bx;
                bench_y[nr] = y[u[nr]] + y[v[nr]] - by;
                bfs_queue.push(nr);
            }
        }
    }
    build(u, v, bench_x, bench_y);
    return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 342 ms 36108 KB Output is correct
10 Correct 14 ms 4052 KB Output is correct
11 Correct 97 ms 19672 KB Output is correct
12 Correct 23 ms 5900 KB Output is correct
13 Correct 60 ms 14536 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 346 ms 36212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 342 ms 36108 KB Output is correct
10 Correct 14 ms 4052 KB Output is correct
11 Correct 97 ms 19672 KB Output is correct
12 Correct 23 ms 5900 KB Output is correct
13 Correct 60 ms 14536 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 346 ms 36212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 914 ms 61096 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 4 ms 980 KB Output is correct
27 Correct 6 ms 1280 KB Output is correct
28 Correct 243 ms 24620 KB Output is correct
29 Correct 495 ms 36756 KB Output is correct
30 Correct 675 ms 48824 KB Output is correct
31 Correct 909 ms 60996 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 0 ms 300 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 3 ms 724 KB Output is correct
44 Correct 4 ms 952 KB Output is correct
45 Correct 300 ms 29260 KB Output is correct
46 Correct 532 ms 42300 KB Output is correct
47 Correct 487 ms 42280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 342 ms 36108 KB Output is correct
10 Correct 14 ms 4052 KB Output is correct
11 Correct 97 ms 19672 KB Output is correct
12 Correct 23 ms 5900 KB Output is correct
13 Correct 60 ms 14536 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 346 ms 36212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 914 ms 61096 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 4 ms 980 KB Output is correct
27 Correct 6 ms 1280 KB Output is correct
28 Correct 243 ms 24620 KB Output is correct
29 Correct 495 ms 36756 KB Output is correct
30 Correct 675 ms 48824 KB Output is correct
31 Correct 909 ms 60996 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 0 ms 300 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 3 ms 724 KB Output is correct
44 Correct 4 ms 952 KB Output is correct
45 Correct 300 ms 29260 KB Output is correct
46 Correct 532 ms 42300 KB Output is correct
47 Correct 487 ms 42280 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 300 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 1 ms 300 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1061 ms 57396 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 3 ms 724 KB Output is correct
58 Correct 11 ms 2132 KB Output is correct
59 Correct 20 ms 2752 KB Output is correct
60 Correct 400 ms 28840 KB Output is correct
61 Correct 599 ms 38764 KB Output is correct
62 Correct 839 ms 47240 KB Output is correct
63 Correct 943 ms 57540 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 1 ms 304 KB Output is correct
67 Correct 921 ms 72080 KB Output is correct
68 Correct 859 ms 72000 KB Output is correct
69 Correct 874 ms 71664 KB Output is correct
70 Correct 6 ms 1236 KB Output is correct
71 Correct 11 ms 2300 KB Output is correct
72 Correct 278 ms 28756 KB Output is correct
73 Correct 571 ms 42928 KB Output is correct
74 Correct 797 ms 57352 KB Output is correct
75 Correct 835 ms 63260 KB Output is correct
76 Correct 883 ms 72060 KB Output is correct
77 Correct 7 ms 1492 KB Output is correct
78 Correct 13 ms 2556 KB Output is correct
79 Correct 292 ms 29872 KB Output is correct
80 Correct 553 ms 44528 KB Output is correct
81 Correct 828 ms 59536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 342 ms 36108 KB Output is correct
10 Correct 14 ms 4052 KB Output is correct
11 Correct 97 ms 19672 KB Output is correct
12 Correct 23 ms 5900 KB Output is correct
13 Correct 60 ms 14536 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 346 ms 36212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 588 ms 50144 KB Output is correct
21 Correct 607 ms 50056 KB Output is correct
22 Correct 707 ms 50152 KB Output is correct
23 Correct 629 ms 61056 KB Output is correct
24 Correct 268 ms 20468 KB Output is correct
25 Correct 634 ms 64044 KB Output is correct
26 Correct 730 ms 64084 KB Output is correct
27 Correct 870 ms 71940 KB Output is correct
28 Correct 885 ms 71920 KB Output is correct
29 Correct 781 ms 71924 KB Output is correct
30 Correct 755 ms 71912 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 29 ms 4716 KB Output is correct
33 Correct 93 ms 10208 KB Output is correct
34 Correct 617 ms 50208 KB Output is correct
35 Correct 16 ms 2644 KB Output is correct
36 Correct 104 ms 12016 KB Output is correct
37 Correct 286 ms 23428 KB Output is correct
38 Correct 232 ms 21908 KB Output is correct
39 Correct 383 ms 29928 KB Output is correct
40 Correct 561 ms 38100 KB Output is correct
41 Correct 715 ms 46208 KB Output is correct
42 Correct 896 ms 54296 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 1 ms 300 KB Output is correct
47 Correct 0 ms 304 KB Output is correct
48 Correct 1 ms 304 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 296 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 0 ms 212 KB Output is correct
54 Correct 3 ms 696 KB Output is correct
55 Correct 4 ms 980 KB Output is correct
56 Correct 281 ms 29280 KB Output is correct
57 Correct 483 ms 42316 KB Output is correct
58 Correct 503 ms 42272 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 876 ms 72060 KB Output is correct
63 Correct 895 ms 72000 KB Output is correct
64 Correct 890 ms 71600 KB Output is correct
65 Correct 6 ms 1236 KB Output is correct
66 Correct 11 ms 2276 KB Output is correct
67 Correct 310 ms 28832 KB Output is correct
68 Correct 532 ms 42956 KB Output is correct
69 Correct 846 ms 57292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 342 ms 36108 KB Output is correct
10 Correct 14 ms 4052 KB Output is correct
11 Correct 97 ms 19672 KB Output is correct
12 Correct 23 ms 5900 KB Output is correct
13 Correct 60 ms 14536 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 346 ms 36212 KB Output is correct
17 Correct 812 ms 72156 KB Output is correct
18 Correct 828 ms 72020 KB Output is correct
19 Correct 681 ms 50132 KB Output is correct
20 Correct 840 ms 56224 KB Output is correct
21 Correct 777 ms 56536 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 70 ms 9892 KB Output is correct
24 Correct 45 ms 5376 KB Output is correct
25 Correct 155 ms 17100 KB Output is correct
26 Correct 368 ms 29160 KB Output is correct
27 Correct 386 ms 28216 KB Output is correct
28 Correct 525 ms 35452 KB Output is correct
29 Correct 672 ms 42372 KB Output is correct
30 Correct 957 ms 49200 KB Output is correct
31 Correct 1192 ms 56756 KB Output is correct
32 Correct 901 ms 63516 KB Output is correct
33 Correct 929 ms 72204 KB Output is correct
34 Correct 9 ms 1540 KB Output is correct
35 Correct 14 ms 2644 KB Output is correct
36 Correct 330 ms 30040 KB Output is correct
37 Correct 571 ms 44888 KB Output is correct
38 Correct 919 ms 59760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 342 ms 36108 KB Output is correct
10 Correct 14 ms 4052 KB Output is correct
11 Correct 97 ms 19672 KB Output is correct
12 Correct 23 ms 5900 KB Output is correct
13 Correct 60 ms 14536 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 346 ms 36212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 914 ms 61096 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 4 ms 980 KB Output is correct
27 Correct 6 ms 1280 KB Output is correct
28 Correct 243 ms 24620 KB Output is correct
29 Correct 495 ms 36756 KB Output is correct
30 Correct 675 ms 48824 KB Output is correct
31 Correct 909 ms 60996 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 0 ms 300 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 3 ms 724 KB Output is correct
44 Correct 4 ms 952 KB Output is correct
45 Correct 300 ms 29260 KB Output is correct
46 Correct 532 ms 42300 KB Output is correct
47 Correct 487 ms 42280 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 300 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 1 ms 300 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1061 ms 57396 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 3 ms 724 KB Output is correct
58 Correct 11 ms 2132 KB Output is correct
59 Correct 20 ms 2752 KB Output is correct
60 Correct 400 ms 28840 KB Output is correct
61 Correct 599 ms 38764 KB Output is correct
62 Correct 839 ms 47240 KB Output is correct
63 Correct 943 ms 57540 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 1 ms 304 KB Output is correct
67 Correct 921 ms 72080 KB Output is correct
68 Correct 859 ms 72000 KB Output is correct
69 Correct 874 ms 71664 KB Output is correct
70 Correct 6 ms 1236 KB Output is correct
71 Correct 11 ms 2300 KB Output is correct
72 Correct 278 ms 28756 KB Output is correct
73 Correct 571 ms 42928 KB Output is correct
74 Correct 797 ms 57352 KB Output is correct
75 Correct 835 ms 63260 KB Output is correct
76 Correct 883 ms 72060 KB Output is correct
77 Correct 7 ms 1492 KB Output is correct
78 Correct 13 ms 2556 KB Output is correct
79 Correct 292 ms 29872 KB Output is correct
80 Correct 553 ms 44528 KB Output is correct
81 Correct 828 ms 59536 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 0 ms 212 KB Output is correct
85 Correct 588 ms 50144 KB Output is correct
86 Correct 607 ms 50056 KB Output is correct
87 Correct 707 ms 50152 KB Output is correct
88 Correct 629 ms 61056 KB Output is correct
89 Correct 268 ms 20468 KB Output is correct
90 Correct 634 ms 64044 KB Output is correct
91 Correct 730 ms 64084 KB Output is correct
92 Correct 870 ms 71940 KB Output is correct
93 Correct 885 ms 71920 KB Output is correct
94 Correct 781 ms 71924 KB Output is correct
95 Correct 755 ms 71912 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 29 ms 4716 KB Output is correct
98 Correct 93 ms 10208 KB Output is correct
99 Correct 617 ms 50208 KB Output is correct
100 Correct 16 ms 2644 KB Output is correct
101 Correct 104 ms 12016 KB Output is correct
102 Correct 286 ms 23428 KB Output is correct
103 Correct 232 ms 21908 KB Output is correct
104 Correct 383 ms 29928 KB Output is correct
105 Correct 561 ms 38100 KB Output is correct
106 Correct 715 ms 46208 KB Output is correct
107 Correct 896 ms 54296 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 0 ms 212 KB Output is correct
110 Correct 0 ms 212 KB Output is correct
111 Correct 1 ms 300 KB Output is correct
112 Correct 0 ms 304 KB Output is correct
113 Correct 1 ms 304 KB Output is correct
114 Correct 1 ms 212 KB Output is correct
115 Correct 1 ms 296 KB Output is correct
116 Correct 1 ms 212 KB Output is correct
117 Correct 0 ms 212 KB Output is correct
118 Correct 0 ms 212 KB Output is correct
119 Correct 3 ms 696 KB Output is correct
120 Correct 4 ms 980 KB Output is correct
121 Correct 281 ms 29280 KB Output is correct
122 Correct 483 ms 42316 KB Output is correct
123 Correct 503 ms 42272 KB Output is correct
124 Correct 0 ms 212 KB Output is correct
125 Correct 0 ms 212 KB Output is correct
126 Correct 1 ms 212 KB Output is correct
127 Correct 876 ms 72060 KB Output is correct
128 Correct 895 ms 72000 KB Output is correct
129 Correct 890 ms 71600 KB Output is correct
130 Correct 6 ms 1236 KB Output is correct
131 Correct 11 ms 2276 KB Output is correct
132 Correct 310 ms 28832 KB Output is correct
133 Correct 532 ms 42956 KB Output is correct
134 Correct 846 ms 57292 KB Output is correct
135 Correct 812 ms 72156 KB Output is correct
136 Correct 828 ms 72020 KB Output is correct
137 Correct 681 ms 50132 KB Output is correct
138 Correct 840 ms 56224 KB Output is correct
139 Correct 777 ms 56536 KB Output is correct
140 Correct 0 ms 212 KB Output is correct
141 Correct 70 ms 9892 KB Output is correct
142 Correct 45 ms 5376 KB Output is correct
143 Correct 155 ms 17100 KB Output is correct
144 Correct 368 ms 29160 KB Output is correct
145 Correct 386 ms 28216 KB Output is correct
146 Correct 525 ms 35452 KB Output is correct
147 Correct 672 ms 42372 KB Output is correct
148 Correct 957 ms 49200 KB Output is correct
149 Correct 1192 ms 56756 KB Output is correct
150 Correct 901 ms 63516 KB Output is correct
151 Correct 929 ms 72204 KB Output is correct
152 Correct 9 ms 1540 KB Output is correct
153 Correct 14 ms 2644 KB Output is correct
154 Correct 330 ms 30040 KB Output is correct
155 Correct 571 ms 44888 KB Output is correct
156 Correct 919 ms 59760 KB Output is correct
157 Correct 0 ms 292 KB Output is correct
158 Correct 1 ms 212 KB Output is correct
159 Correct 0 ms 212 KB Output is correct
160 Correct 0 ms 212 KB Output is correct
161 Correct 1067 ms 50620 KB Output is correct
162 Correct 657 ms 50608 KB Output is correct
163 Correct 721 ms 50628 KB Output is correct
164 Correct 672 ms 50628 KB Output is correct
165 Incorrect 812 ms 50632 KB Tree @(44441, 44453) appears more than once: for edges on positions 129952 and 177775
166 Halted 0 ms 0 KB -