Submission #606218

# Submission time Handle Problem Language Result Execution time Memory
606218 2022-07-26T05:36:41 Z KoD Fountain Parks (IOI21_parks) C++17
100 / 100
1959 ms 82588 KB
#include "parks.h"
#include <bits/stdc++.h>

using std::array;
using std::pair;
using std::tuple;
using std::vector;

template <class F>
struct fixed : private F {
    explicit fixed(F&& f) : F(std::forward<F>(f)) {}
    template <class... Args>
    decltype(auto) operator()(Args&&... args) const {
        return F::operator()(*this, std::forward<Args>(args)...);
    }
};

struct UnionFind {
    vector<int> data;
    explicit UnionFind(const int n) : data(n, -1) {}
    int find(const int u) {
        return data[u] < 0 ? u : data[u] = find(data[u]);
    }
    bool merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (data[x] > data[y]) std::swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
};

struct Points {
    vector<pair<int, int>> pts;
    std::map<pair<int, int>, int> map;

    Points() : pts(), map() {}

    int add_or_get(const pair<int, int>& p) {
        if (const auto itr = map.find(p); itr != map.end()) {
            return itr->second;
        } else {
            pts.push_back(p);
            return map[p] = (int)pts.size() - 1;
        }
    }

    int try_get(const pair<int, int>& p) const {
        if (const auto itr = map.find(p); itr != map.end()) {
            return itr->second;
        } else {
            return -1;
        }
    }
};

int construct_roads(vector<int> X, vector<int> Y) {
    const int F = (int)X.size();    
    Points fountain, road, bench;
    for (int i = 0; i < F; ++i) {
        fountain.add_or_get({X[i], Y[i]});
    }
    vector<pair<int, int>> edges;
    for (int i = 0; i < F; ++i) {
        if (const int j = fountain.try_get({X[i] + 2, Y[i]}); j != -1) {
            const int r = road.add_or_get({X[i] + 1, Y[i]});
            if ((X[i] + Y[i]) % 4 == 0) {
                const int b = bench.add_or_get({X[i] + 1, Y[i] + 1});
                edges.emplace_back(r, b);
            } else {
                const int b = bench.add_or_get({X[i] + 1, Y[i] - 1});
                edges.emplace_back(r, b);
            }
        }
        if (const int j = fountain.try_get({X[i], Y[i] + 2}); j != -1) {
            const int r = road.add_or_get({X[i], Y[i] + 1});
            if ((X[i] + Y[i]) % 4 == 0) {
                const int b = bench.add_or_get({X[i] - 1, Y[i] + 1});
                edges.emplace_back(r, b);
            } else {
                const int b = bench.add_or_get({X[i] + 1, Y[i] + 1});
                edges.emplace_back(r, b);
            }
        }
    }
    const int R = (int)road.pts.size();
    const int B = (int)bench.pts.size();
    vector<int> type(B), deg(B);
    for (const auto& [r, b] : edges) {
        deg[b] += 1;
    }
    for (int i = 0; i < B; ++i) {
        const auto& [x, y] = bench.pts[i];
        type[i] = (x / 2 + y / 2) % 2;
    }
    vector<char> use(R, true), visited(B);
    const auto dfs = fixed([&](auto&& dfs, const int r, const int b) -> void {
        if (b == -1 or deg[b] != 2 or visited[b]) {
            return;
        }
        use[r] = false;
        visited[b] = true;
        const auto& [x, y] = bench.pts[b];
        if (type[b] == 1) {
            dfs(road.try_get({x, y - 1}), bench.try_get({x, y - 2}));
            dfs(road.try_get({x, y + 1}), bench.try_get({x, y + 2}));
        } else {
            dfs(road.try_get({x - 1, y}), bench.try_get({x - 2, y}));
            dfs(road.try_get({x + 1, y}), bench.try_get({x + 2, y}));
        }
    });
    for (int src = 0; src < B; ++src) {
        if (deg[src] == 2) {
            const auto& [x, y] = bench.pts[src];
            if (type[src] == 0) {
                if (const int tmp = bench.try_get({x, y - 2}); tmp == -1 or deg[tmp] != 2) {
                    dfs(road.try_get({x, y - 1}), src);
                }
                if (const int tmp = bench.try_get({x, y + 2}); tmp == -1 or deg[tmp] != 2) {
                    dfs(road.try_get({x, y + 1}), src);
                }
            } else {
                if (const int tmp = bench.try_get({x - 2, y}); tmp == -1 or deg[tmp] != 2) {
                    dfs(road.try_get({x - 1, y}), src);
                }
                if (const int tmp = bench.try_get({x + 2, y}); tmp == -1 or deg[tmp] != 2) {
                    dfs(road.try_get({x + 1, y}), src);
                }
            }
        }
    }
    vector<int> match(R);
    for (const auto& [r, b] : edges) {
        if (use[r]) {
            match[r] = b;
        }
    }
    UnionFind dsu(F);
    vector<int> u, v, a, b;
    for (int i = 0; i < R; ++i) {
        if (!use[i]) {
            continue;
        }
        const auto& [x, y] = road.pts[i];
        if (x % 2 == 1) {
            const int s = fountain.try_get({x - 1, y});
            const int t = fountain.try_get({x + 1, y});
            if (dsu.merge(s, t)) {
                u.push_back(s);
                v.push_back(t);
                a.push_back(bench.pts[match[i]].first);
                b.push_back(bench.pts[match[i]].second);
            }
        } else {
            const int s = fountain.try_get({x, y - 1});
            const int t = fountain.try_get({x, y + 1});
            if (dsu.merge(s, t)) {
                u.push_back(s);
                v.push_back(t);
                a.push_back(bench.pts[match[i]].first);
                b.push_back(bench.pts[match[i]].second);
            }
        }
    }
    if ((int)u.size() < F - 1) {
        return 0;
    }
    build(u, v, a, b); 
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 399 ms 30624 KB Output is correct
10 Correct 21 ms 3292 KB Output is correct
11 Correct 114 ms 16580 KB Output is correct
12 Correct 28 ms 4820 KB Output is correct
13 Correct 138 ms 12708 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 373 ms 30572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 399 ms 30624 KB Output is correct
10 Correct 21 ms 3292 KB Output is correct
11 Correct 114 ms 16580 KB Output is correct
12 Correct 28 ms 4820 KB Output is correct
13 Correct 138 ms 12708 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 373 ms 30572 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1528 ms 69476 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 8 ms 1296 KB Output is correct
27 Correct 13 ms 1492 KB Output is correct
28 Correct 518 ms 28308 KB Output is correct
29 Correct 829 ms 41412 KB Output is correct
30 Correct 1114 ms 56260 KB Output is correct
31 Correct 1669 ms 69436 KB Output is correct
32 Correct 1 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 1 ms 300 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 300 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 256 KB Output is correct
43 Correct 4 ms 852 KB Output is correct
44 Correct 6 ms 1076 KB Output is correct
45 Correct 411 ms 30728 KB Output is correct
46 Correct 797 ms 45332 KB Output is correct
47 Correct 858 ms 45328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 399 ms 30624 KB Output is correct
10 Correct 21 ms 3292 KB Output is correct
11 Correct 114 ms 16580 KB Output is correct
12 Correct 28 ms 4820 KB Output is correct
13 Correct 138 ms 12708 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 373 ms 30572 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1528 ms 69476 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 8 ms 1296 KB Output is correct
27 Correct 13 ms 1492 KB Output is correct
28 Correct 518 ms 28308 KB Output is correct
29 Correct 829 ms 41412 KB Output is correct
30 Correct 1114 ms 56260 KB Output is correct
31 Correct 1669 ms 69436 KB Output is correct
32 Correct 1 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 1 ms 300 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 300 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 256 KB Output is correct
43 Correct 4 ms 852 KB Output is correct
44 Correct 6 ms 1076 KB Output is correct
45 Correct 411 ms 30728 KB Output is correct
46 Correct 797 ms 45332 KB Output is correct
47 Correct 858 ms 45328 KB Output is correct
48 Correct 1 ms 296 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 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1959 ms 75356 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 5 ms 948 KB Output is correct
58 Correct 20 ms 2468 KB Output is correct
59 Correct 28 ms 3780 KB Output is correct
60 Correct 650 ms 37356 KB Output is correct
61 Correct 975 ms 52528 KB Output is correct
62 Correct 1287 ms 63292 KB Output is correct
63 Correct 1680 ms 74676 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 909 ms 62636 KB Output is correct
68 Correct 1027 ms 62516 KB Output is correct
69 Correct 1006 ms 62300 KB Output is correct
70 Correct 7 ms 1364 KB Output is correct
71 Correct 19 ms 2488 KB Output is correct
72 Correct 499 ms 31300 KB Output is correct
73 Correct 768 ms 47756 KB Output is correct
74 Correct 978 ms 62600 KB Output is correct
75 Correct 1206 ms 68960 KB Output is correct
76 Correct 865 ms 62536 KB Output is correct
77 Correct 13 ms 1876 KB Output is correct
78 Correct 19 ms 3128 KB Output is correct
79 Correct 464 ms 32996 KB Output is correct
80 Correct 924 ms 50328 KB Output is correct
81 Correct 1291 ms 65944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 399 ms 30624 KB Output is correct
10 Correct 21 ms 3292 KB Output is correct
11 Correct 114 ms 16580 KB Output is correct
12 Correct 28 ms 4820 KB Output is correct
13 Correct 138 ms 12708 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 373 ms 30572 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 260 KB Output is correct
20 Correct 1188 ms 60832 KB Output is correct
21 Correct 1121 ms 60840 KB Output is correct
22 Correct 1028 ms 60852 KB Output is correct
23 Correct 813 ms 52292 KB Output is correct
24 Correct 308 ms 18240 KB Output is correct
25 Correct 1068 ms 56192 KB Output is correct
26 Correct 1031 ms 56116 KB Output is correct
27 Correct 1020 ms 60836 KB Output is correct
28 Correct 1218 ms 60824 KB Output is correct
29 Correct 1181 ms 60920 KB Output is correct
30 Correct 1162 ms 60848 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 47 ms 4472 KB Output is correct
33 Correct 115 ms 9252 KB Output is correct
34 Correct 952 ms 60824 KB Output is correct
35 Correct 22 ms 3052 KB Output is correct
36 Correct 156 ms 14168 KB Output is correct
37 Correct 440 ms 28164 KB Output is correct
38 Correct 319 ms 24768 KB Output is correct
39 Correct 616 ms 33488 KB Output is correct
40 Correct 715 ms 43600 KB Output is correct
41 Correct 913 ms 52196 KB Output is correct
42 Correct 1140 ms 60820 KB Output is correct
43 Correct 0 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 212 KB Output is correct
47 Correct 0 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 0 ms 212 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 3 ms 852 KB Output is correct
55 Correct 5 ms 1108 KB Output is correct
56 Correct 436 ms 30536 KB Output is correct
57 Correct 698 ms 45076 KB Output is correct
58 Correct 729 ms 45100 KB Output is correct
59 Correct 1 ms 240 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 938 ms 60848 KB Output is correct
63 Correct 905 ms 60872 KB Output is correct
64 Correct 1022 ms 60572 KB Output is correct
65 Correct 6 ms 1364 KB Output is correct
66 Correct 14 ms 2428 KB Output is correct
67 Correct 403 ms 30592 KB Output is correct
68 Correct 699 ms 46460 KB Output is correct
69 Correct 1088 ms 60900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 399 ms 30624 KB Output is correct
10 Correct 21 ms 3292 KB Output is correct
11 Correct 114 ms 16580 KB Output is correct
12 Correct 28 ms 4820 KB Output is correct
13 Correct 138 ms 12708 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 373 ms 30572 KB Output is correct
17 Correct 932 ms 60860 KB Output is correct
18 Correct 995 ms 60896 KB Output is correct
19 Correct 892 ms 60864 KB Output is correct
20 Correct 1390 ms 70284 KB Output is correct
21 Correct 1010 ms 56880 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 89 ms 10076 KB Output is correct
24 Correct 48 ms 6564 KB Output is correct
25 Correct 290 ms 22468 KB Output is correct
26 Correct 598 ms 37200 KB Output is correct
27 Correct 540 ms 33732 KB Output is correct
28 Correct 704 ms 41748 KB Output is correct
29 Correct 805 ms 51260 KB Output is correct
30 Correct 1090 ms 59416 KB Output is correct
31 Correct 1256 ms 67248 KB Output is correct
32 Correct 1228 ms 67416 KB Output is correct
33 Correct 1010 ms 60888 KB Output is correct
34 Correct 11 ms 1748 KB Output is correct
35 Correct 24 ms 2936 KB Output is correct
36 Correct 483 ms 32244 KB Output is correct
37 Correct 792 ms 49180 KB Output is correct
38 Correct 1071 ms 64552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 399 ms 30624 KB Output is correct
10 Correct 21 ms 3292 KB Output is correct
11 Correct 114 ms 16580 KB Output is correct
12 Correct 28 ms 4820 KB Output is correct
13 Correct 138 ms 12708 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 373 ms 30572 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1528 ms 69476 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 8 ms 1296 KB Output is correct
27 Correct 13 ms 1492 KB Output is correct
28 Correct 518 ms 28308 KB Output is correct
29 Correct 829 ms 41412 KB Output is correct
30 Correct 1114 ms 56260 KB Output is correct
31 Correct 1669 ms 69436 KB Output is correct
32 Correct 1 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 1 ms 300 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 300 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 256 KB Output is correct
43 Correct 4 ms 852 KB Output is correct
44 Correct 6 ms 1076 KB Output is correct
45 Correct 411 ms 30728 KB Output is correct
46 Correct 797 ms 45332 KB Output is correct
47 Correct 858 ms 45328 KB Output is correct
48 Correct 1 ms 296 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 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1959 ms 75356 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 5 ms 948 KB Output is correct
58 Correct 20 ms 2468 KB Output is correct
59 Correct 28 ms 3780 KB Output is correct
60 Correct 650 ms 37356 KB Output is correct
61 Correct 975 ms 52528 KB Output is correct
62 Correct 1287 ms 63292 KB Output is correct
63 Correct 1680 ms 74676 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 909 ms 62636 KB Output is correct
68 Correct 1027 ms 62516 KB Output is correct
69 Correct 1006 ms 62300 KB Output is correct
70 Correct 7 ms 1364 KB Output is correct
71 Correct 19 ms 2488 KB Output is correct
72 Correct 499 ms 31300 KB Output is correct
73 Correct 768 ms 47756 KB Output is correct
74 Correct 978 ms 62600 KB Output is correct
75 Correct 1206 ms 68960 KB Output is correct
76 Correct 865 ms 62536 KB Output is correct
77 Correct 13 ms 1876 KB Output is correct
78 Correct 19 ms 3128 KB Output is correct
79 Correct 464 ms 32996 KB Output is correct
80 Correct 924 ms 50328 KB Output is correct
81 Correct 1291 ms 65944 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 0 ms 212 KB Output is correct
84 Correct 1 ms 260 KB Output is correct
85 Correct 1188 ms 60832 KB Output is correct
86 Correct 1121 ms 60840 KB Output is correct
87 Correct 1028 ms 60852 KB Output is correct
88 Correct 813 ms 52292 KB Output is correct
89 Correct 308 ms 18240 KB Output is correct
90 Correct 1068 ms 56192 KB Output is correct
91 Correct 1031 ms 56116 KB Output is correct
92 Correct 1020 ms 60836 KB Output is correct
93 Correct 1218 ms 60824 KB Output is correct
94 Correct 1181 ms 60920 KB Output is correct
95 Correct 1162 ms 60848 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 47 ms 4472 KB Output is correct
98 Correct 115 ms 9252 KB Output is correct
99 Correct 952 ms 60824 KB Output is correct
100 Correct 22 ms 3052 KB Output is correct
101 Correct 156 ms 14168 KB Output is correct
102 Correct 440 ms 28164 KB Output is correct
103 Correct 319 ms 24768 KB Output is correct
104 Correct 616 ms 33488 KB Output is correct
105 Correct 715 ms 43600 KB Output is correct
106 Correct 913 ms 52196 KB Output is correct
107 Correct 1140 ms 60820 KB Output is correct
108 Correct 0 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 212 KB Output is correct
112 Correct 0 ms 212 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 1 ms 212 KB Output is correct
115 Correct 1 ms 212 KB Output is correct
116 Correct 0 ms 212 KB Output is correct
117 Correct 0 ms 212 KB Output is correct
118 Correct 1 ms 212 KB Output is correct
119 Correct 3 ms 852 KB Output is correct
120 Correct 5 ms 1108 KB Output is correct
121 Correct 436 ms 30536 KB Output is correct
122 Correct 698 ms 45076 KB Output is correct
123 Correct 729 ms 45100 KB Output is correct
124 Correct 1 ms 240 KB Output is correct
125 Correct 1 ms 212 KB Output is correct
126 Correct 1 ms 212 KB Output is correct
127 Correct 938 ms 60848 KB Output is correct
128 Correct 905 ms 60872 KB Output is correct
129 Correct 1022 ms 60572 KB Output is correct
130 Correct 6 ms 1364 KB Output is correct
131 Correct 14 ms 2428 KB Output is correct
132 Correct 403 ms 30592 KB Output is correct
133 Correct 699 ms 46460 KB Output is correct
134 Correct 1088 ms 60900 KB Output is correct
135 Correct 932 ms 60860 KB Output is correct
136 Correct 995 ms 60896 KB Output is correct
137 Correct 892 ms 60864 KB Output is correct
138 Correct 1390 ms 70284 KB Output is correct
139 Correct 1010 ms 56880 KB Output is correct
140 Correct 0 ms 212 KB Output is correct
141 Correct 89 ms 10076 KB Output is correct
142 Correct 48 ms 6564 KB Output is correct
143 Correct 290 ms 22468 KB Output is correct
144 Correct 598 ms 37200 KB Output is correct
145 Correct 540 ms 33732 KB Output is correct
146 Correct 704 ms 41748 KB Output is correct
147 Correct 805 ms 51260 KB Output is correct
148 Correct 1090 ms 59416 KB Output is correct
149 Correct 1256 ms 67248 KB Output is correct
150 Correct 1228 ms 67416 KB Output is correct
151 Correct 1010 ms 60888 KB Output is correct
152 Correct 11 ms 1748 KB Output is correct
153 Correct 24 ms 2936 KB Output is correct
154 Correct 483 ms 32244 KB Output is correct
155 Correct 792 ms 49180 KB Output is correct
156 Correct 1071 ms 64552 KB Output is correct
157 Correct 1 ms 212 KB Output is correct
158 Correct 1 ms 212 KB Output is correct
159 Correct 1 ms 212 KB Output is correct
160 Correct 1 ms 212 KB Output is correct
161 Correct 1833 ms 82588 KB Output is correct
162 Correct 850 ms 63424 KB Output is correct
163 Correct 1093 ms 69016 KB Output is correct
164 Correct 1214 ms 66728 KB Output is correct
165 Correct 1515 ms 75068 KB Output is correct
166 Correct 1592 ms 78608 KB Output is correct
167 Correct 234 ms 18076 KB Output is correct
168 Correct 136 ms 11440 KB Output is correct
169 Correct 518 ms 30300 KB Output is correct
170 Correct 1167 ms 56816 KB Output is correct
171 Correct 1805 ms 74144 KB Output is correct
172 Correct 867 ms 40996 KB Output is correct
173 Correct 1130 ms 48980 KB Output is correct
174 Correct 1271 ms 58348 KB Output is correct
175 Correct 1439 ms 66032 KB Output is correct
176 Correct 1562 ms 74232 KB Output is correct
177 Correct 1767 ms 81744 KB Output is correct