답안 #1072044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072044 2024-08-23T13:39:30 Z shmax 분수 공원 (IOI21_parks) C++17
70 / 100
2021 ms 84332 KB
#include "parks.h"
#include <bits/stdc++.h>


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

using namespace std;

using i32 = int;
//#define int long long
#define len(x) (int)(x.size())
template<typename T>
using vec = vector<T>;

struct DSU {
public:
    DSU() : _n(0) {}

    explicit DSU(int n) : _n(n), parent_or_size(n, -1) {}

    int unite(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool one(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
                std::remove_if(result.begin(), result.end(),
                               [&](const std::vector<int> &v) { return v.empty(); }),
                result.end());
        return result;
    }

private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};


i32 construct_roads(std::vector<i32> _x, std::vector<i32> _y) {
    int n = len(_x);
    map<pair<int, int>, int> mp;
    for (int i = 0; i < n; i++) {
        mp[{_x[i], _y[i]}] = i;
    }
    mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
    vec<pair<int, int>> edges;
    for (int i = 0; i < n; i++) {
        vec<pair<int, int>> moves = {{-2, 0},
                                     {2,  0}};
        for (auto [dx, dy]: moves) {
            int nx = _x[i] + dx;
            int ny = _y[i] + dy;
            if (!mp.count({nx, ny})) continue;
            edges.push_back({i, mp[{nx, ny}]});
        }
    }
    for (int i = 0; i < n; i++) {
        vec<pair<int, int>> moves = {{0, -2},
                                     {0, 2}};
        for (auto [dx, dy]: moves) {
            int nx = _x[i] + dx;
            int ny = _y[i] + dy;
            if (!mp.count({nx, ny})) continue;
            edges.push_back({i, mp[{nx, ny}]});
        }
    }
    for (int times = 0; times < 5; times++) {
        DSU dsu(n);
        reverse(edges.begin(), edges.end());
        vec<pair<int, int>> used_edges;
        for (auto [a, b]: edges) {
            if (dsu.one(a, b)) continue;
            dsu.unite(a, b);
            used_edges.emplace_back(a, b);
        }
        if (dsu.size(0) != n) return 0;
        shuffle(used_edges.begin(), used_edges.end(), rnd);
        map<pair<int, int>, int> benches;
        vec<pair<int, int>> benches_pos;
        int idx = 0;
        for (auto [a, b]: used_edges) {
            auto [x1, y1] = pair<int, int>{_x[a], _y[a]};
            auto [x2, y2] = pair<int, int>{_x[b], _y[b]};
            if (x1 == x2) {
                if (!benches.count({x1 - 1, (y1 + y2) / 2}))
                    benches[{x1 - 1, (y1 + y2) / 2}] = idx++, benches_pos.emplace_back(x1 - 1, (y1 + y2) / 2);
                if (!benches.count({x1 + 1, (y1 + y2) / 2}))
                    benches[{x1 + 1, (y1 + y2) / 2}] = idx++, benches_pos.emplace_back(x1 + 1, (y1 + y2) / 2);
            } else {
                if (!benches.count({(x1 + x2) / 2, y1 - 1}))
                    benches[{(x1 + x2) / 2, y1 - 1}] = idx++, benches_pos.emplace_back((x1 + x2) / 2, y1 - 1);
                if (!benches.count({(x1 + x2) / 2, y1 + 1}))
                    benches[{(x1 + x2) / 2, y1 + 1}] = idx++, benches_pos.emplace_back((x1 + x2) / 2, y1 + 1);
            }
        }
        vec<vec<int>> g(n - 1 + len(benches));
        int idt = 0;
        for (auto [a, b]: used_edges) {
            auto [x1, y1] = pair<int, int>{_x[a], _y[a]};
            auto [x2, y2] = pair<int, int>{_x[b], _y[b]};
            if (x1 == x2) {
                g[idt].push_back(n - 1 + benches[{x1 - 1, (y1 + y2) / 2}]);
                g[idt].push_back(n - 1 + benches[{x1 + 1, (y1 + y2) / 2}]);
            } else {
                g[idt].push_back(n - 1 + benches[{(x1 + x2) / 2, y1 - 1}]);
                g[idt].push_back(n - 1 + benches[{(x1 + x2) / 2, y1 + 1}]);
            }
            idt++;
        }

//        matching
//        shuffle
        for (int i = 0; i < n - 1; i++) {
            shuffle(g[i].begin(), g[i].end(), rnd);
        }

        vec<int> match(n - 1 + len(benches), -1);
        vec<bool> used(n - 1 + len(benches), false);
        function<bool(int)> dfs = [&](int v) -> bool {
            if (used[v]) return false;
            used[v] = true;
            for (auto u: g[v]) {
                if (match[u] == -1 || dfs(match[u])) {
                    match[u] = v;
                    match[v] = u;
                    return true;
                }
            }
            return false;
        };

        bool flag = true;
        do {
            flag = false;
            fill(used.begin(), used.end(), false);
            for (int i = 0; i < n - 1; i++) {
                if (match[i] == -1) {
                    if (dfs(i)) {
                        flag = true;
                    }
                }
            }
        } while (flag);

        int cnt = 0;
        for (int i = 0; i < n - 1; i++) {
            if (match[i] != -1) cnt++;
        }

        if (cnt == n - 1) {
            vec<i32> x_benches, y_benches;
            vec<i32> u, v;
            for (int i = 0; i < n - 1; i++) {
                x_benches.push_back(benches_pos[match[i] - n + 1].first);
                y_benches.push_back(benches_pos[match[i] - n + 1].second);
                u.push_back(used_edges[i].first);
                v.push_back(used_edges[i].second);
            }
            build(u, v, x_benches, y_benches);
            return 1;
        }


    }

    return 0;
}

Compilation message

parks.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    7 | #pragma GCC optimization("unroll-loops")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 288 ms 41344 KB Output is correct
10 Correct 21 ms 4444 KB Output is correct
11 Correct 114 ms 22524 KB Output is correct
12 Correct 28 ms 6480 KB Output is correct
13 Correct 32 ms 5580 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 282 ms 41512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 288 ms 41344 KB Output is correct
10 Correct 21 ms 4444 KB Output is correct
11 Correct 114 ms 22524 KB Output is correct
12 Correct 28 ms 6480 KB Output is correct
13 Correct 32 ms 5580 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 282 ms 41512 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 420 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 821 ms 74508 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 860 KB Output is correct
27 Correct 4 ms 860 KB Output is correct
28 Correct 253 ms 30156 KB Output is correct
29 Correct 387 ms 44360 KB Output is correct
30 Correct 557 ms 60224 KB Output is correct
31 Correct 780 ms 76732 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 396 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 2 ms 604 KB Output is correct
44 Correct 3 ms 604 KB Output is correct
45 Correct 286 ms 35264 KB Output is correct
46 Correct 482 ms 52932 KB Output is correct
47 Correct 493 ms 51980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 288 ms 41344 KB Output is correct
10 Correct 21 ms 4444 KB Output is correct
11 Correct 114 ms 22524 KB Output is correct
12 Correct 28 ms 6480 KB Output is correct
13 Correct 32 ms 5580 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 282 ms 41512 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 420 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 821 ms 74508 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 860 KB Output is correct
27 Correct 4 ms 860 KB Output is correct
28 Correct 253 ms 30156 KB Output is correct
29 Correct 387 ms 44360 KB Output is correct
30 Correct 557 ms 60224 KB Output is correct
31 Correct 780 ms 76732 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 396 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 2 ms 604 KB Output is correct
44 Correct 3 ms 604 KB Output is correct
45 Correct 286 ms 35264 KB Output is correct
46 Correct 482 ms 52932 KB Output is correct
47 Correct 493 ms 51980 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 744 ms 75548 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 3 ms 1116 KB Output is correct
58 Correct 11 ms 2616 KB Output is correct
59 Correct 11 ms 1760 KB Output is correct
60 Correct 300 ms 37916 KB Output is correct
61 Correct 453 ms 50372 KB Output is correct
62 Correct 605 ms 62128 KB Output is correct
63 Correct 762 ms 76988 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 604 KB Output is correct
67 Correct 671 ms 84332 KB Output is correct
68 Correct 649 ms 84168 KB Output is correct
69 Correct 631 ms 83796 KB Output is correct
70 Correct 4 ms 856 KB Output is correct
71 Correct 7 ms 1372 KB Output is correct
72 Correct 286 ms 35520 KB Output is correct
73 Correct 494 ms 54456 KB Output is correct
74 Correct 702 ms 71212 KB Output is correct
75 Correct 748 ms 78040 KB Output is correct
76 Correct 630 ms 84168 KB Output is correct
77 Correct 5 ms 1112 KB Output is correct
78 Correct 10 ms 1492 KB Output is correct
79 Correct 297 ms 36768 KB Output is correct
80 Correct 523 ms 55988 KB Output is correct
81 Correct 740 ms 73400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 288 ms 41344 KB Output is correct
10 Correct 21 ms 4444 KB Output is correct
11 Correct 114 ms 22524 KB Output is correct
12 Correct 28 ms 6480 KB Output is correct
13 Correct 32 ms 5580 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 282 ms 41512 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 735 ms 71128 KB Output is correct
21 Correct 711 ms 68036 KB Output is correct
22 Correct 740 ms 67012 KB Output is correct
23 Correct 581 ms 72120 KB Output is correct
24 Correct 214 ms 16720 KB Output is correct
25 Correct 340 ms 24004 KB Output is correct
26 Correct 303 ms 23492 KB Output is correct
27 Correct 697 ms 83904 KB Output is correct
28 Correct 750 ms 83240 KB Output is correct
29 Correct 803 ms 83396 KB Output is correct
30 Correct 803 ms 83136 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 32 ms 4984 KB Output is correct
33 Correct 122 ms 8532 KB Output is correct
34 Correct 741 ms 74024 KB Output is correct
35 Correct 11 ms 1504 KB Output is correct
36 Correct 71 ms 6004 KB Output is correct
37 Correct 159 ms 11828 KB Output is correct
38 Correct 239 ms 27276 KB Output is correct
39 Correct 358 ms 36736 KB Output is correct
40 Correct 530 ms 49624 KB Output is correct
41 Correct 635 ms 57176 KB Output is correct
42 Correct 817 ms 66880 KB Output is correct
43 Correct 0 ms 344 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 500 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 2 ms 604 KB Output is correct
55 Correct 2 ms 604 KB Output is correct
56 Correct 314 ms 35268 KB Output is correct
57 Correct 492 ms 52888 KB Output is correct
58 Correct 478 ms 51904 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 642 ms 82592 KB Output is correct
63 Correct 769 ms 82556 KB Output is correct
64 Correct 697 ms 82704 KB Output is correct
65 Correct 4 ms 860 KB Output is correct
66 Correct 7 ms 1368 KB Output is correct
67 Correct 323 ms 34828 KB Output is correct
68 Correct 566 ms 53304 KB Output is correct
69 Correct 870 ms 69484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 288 ms 41344 KB Output is correct
10 Correct 21 ms 4444 KB Output is correct
11 Correct 114 ms 22524 KB Output is correct
12 Correct 28 ms 6480 KB Output is correct
13 Correct 32 ms 5580 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 282 ms 41512 KB Output is correct
17 Correct 843 ms 82772 KB Output is correct
18 Correct 743 ms 82508 KB Output is correct
19 Correct 783 ms 68540 KB Output is correct
20 Correct 726 ms 69316 KB Output is correct
21 Correct 654 ms 69564 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 79 ms 10944 KB Output is correct
24 Correct 25 ms 2772 KB Output is correct
25 Correct 102 ms 9048 KB Output is correct
26 Correct 190 ms 14792 KB Output is correct
27 Correct 315 ms 34696 KB Output is correct
28 Correct 400 ms 42936 KB Output is correct
29 Correct 503 ms 52920 KB Output is correct
30 Correct 617 ms 61396 KB Output is correct
31 Correct 741 ms 68988 KB Output is correct
32 Correct 701 ms 76228 KB Output is correct
33 Correct 648 ms 84164 KB Output is correct
34 Correct 5 ms 860 KB Output is correct
35 Correct 11 ms 1480 KB Output is correct
36 Correct 314 ms 35944 KB Output is correct
37 Correct 487 ms 54740 KB Output is correct
38 Correct 698 ms 74436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 288 ms 41344 KB Output is correct
10 Correct 21 ms 4444 KB Output is correct
11 Correct 114 ms 22524 KB Output is correct
12 Correct 28 ms 6480 KB Output is correct
13 Correct 32 ms 5580 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 282 ms 41512 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 420 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 821 ms 74508 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 860 KB Output is correct
27 Correct 4 ms 860 KB Output is correct
28 Correct 253 ms 30156 KB Output is correct
29 Correct 387 ms 44360 KB Output is correct
30 Correct 557 ms 60224 KB Output is correct
31 Correct 780 ms 76732 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 396 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 2 ms 604 KB Output is correct
44 Correct 3 ms 604 KB Output is correct
45 Correct 286 ms 35264 KB Output is correct
46 Correct 482 ms 52932 KB Output is correct
47 Correct 493 ms 51980 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 744 ms 75548 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 3 ms 1116 KB Output is correct
58 Correct 11 ms 2616 KB Output is correct
59 Correct 11 ms 1760 KB Output is correct
60 Correct 300 ms 37916 KB Output is correct
61 Correct 453 ms 50372 KB Output is correct
62 Correct 605 ms 62128 KB Output is correct
63 Correct 762 ms 76988 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 604 KB Output is correct
67 Correct 671 ms 84332 KB Output is correct
68 Correct 649 ms 84168 KB Output is correct
69 Correct 631 ms 83796 KB Output is correct
70 Correct 4 ms 856 KB Output is correct
71 Correct 7 ms 1372 KB Output is correct
72 Correct 286 ms 35520 KB Output is correct
73 Correct 494 ms 54456 KB Output is correct
74 Correct 702 ms 71212 KB Output is correct
75 Correct 748 ms 78040 KB Output is correct
76 Correct 630 ms 84168 KB Output is correct
77 Correct 5 ms 1112 KB Output is correct
78 Correct 10 ms 1492 KB Output is correct
79 Correct 297 ms 36768 KB Output is correct
80 Correct 523 ms 55988 KB Output is correct
81 Correct 740 ms 73400 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 735 ms 71128 KB Output is correct
86 Correct 711 ms 68036 KB Output is correct
87 Correct 740 ms 67012 KB Output is correct
88 Correct 581 ms 72120 KB Output is correct
89 Correct 214 ms 16720 KB Output is correct
90 Correct 340 ms 24004 KB Output is correct
91 Correct 303 ms 23492 KB Output is correct
92 Correct 697 ms 83904 KB Output is correct
93 Correct 750 ms 83240 KB Output is correct
94 Correct 803 ms 83396 KB Output is correct
95 Correct 803 ms 83136 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 32 ms 4984 KB Output is correct
98 Correct 122 ms 8532 KB Output is correct
99 Correct 741 ms 74024 KB Output is correct
100 Correct 11 ms 1504 KB Output is correct
101 Correct 71 ms 6004 KB Output is correct
102 Correct 159 ms 11828 KB Output is correct
103 Correct 239 ms 27276 KB Output is correct
104 Correct 358 ms 36736 KB Output is correct
105 Correct 530 ms 49624 KB Output is correct
106 Correct 635 ms 57176 KB Output is correct
107 Correct 817 ms 66880 KB Output is correct
108 Correct 0 ms 344 KB Output is correct
109 Correct 0 ms 348 KB Output is correct
110 Correct 1 ms 500 KB Output is correct
111 Correct 1 ms 348 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 0 ms 348 KB Output is correct
114 Correct 0 ms 348 KB Output is correct
115 Correct 0 ms 348 KB Output is correct
116 Correct 0 ms 348 KB Output is correct
117 Correct 0 ms 348 KB Output is correct
118 Correct 1 ms 348 KB Output is correct
119 Correct 2 ms 604 KB Output is correct
120 Correct 2 ms 604 KB Output is correct
121 Correct 314 ms 35268 KB Output is correct
122 Correct 492 ms 52888 KB Output is correct
123 Correct 478 ms 51904 KB Output is correct
124 Correct 1 ms 348 KB Output is correct
125 Correct 0 ms 348 KB Output is correct
126 Correct 0 ms 348 KB Output is correct
127 Correct 642 ms 82592 KB Output is correct
128 Correct 769 ms 82556 KB Output is correct
129 Correct 697 ms 82704 KB Output is correct
130 Correct 4 ms 860 KB Output is correct
131 Correct 7 ms 1368 KB Output is correct
132 Correct 323 ms 34828 KB Output is correct
133 Correct 566 ms 53304 KB Output is correct
134 Correct 870 ms 69484 KB Output is correct
135 Correct 843 ms 82772 KB Output is correct
136 Correct 743 ms 82508 KB Output is correct
137 Correct 783 ms 68540 KB Output is correct
138 Correct 726 ms 69316 KB Output is correct
139 Correct 654 ms 69564 KB Output is correct
140 Correct 0 ms 344 KB Output is correct
141 Correct 79 ms 10944 KB Output is correct
142 Correct 25 ms 2772 KB Output is correct
143 Correct 102 ms 9048 KB Output is correct
144 Correct 190 ms 14792 KB Output is correct
145 Correct 315 ms 34696 KB Output is correct
146 Correct 400 ms 42936 KB Output is correct
147 Correct 503 ms 52920 KB Output is correct
148 Correct 617 ms 61396 KB Output is correct
149 Correct 741 ms 68988 KB Output is correct
150 Correct 701 ms 76228 KB Output is correct
151 Correct 648 ms 84164 KB Output is correct
152 Correct 5 ms 860 KB Output is correct
153 Correct 11 ms 1480 KB Output is correct
154 Correct 314 ms 35944 KB Output is correct
155 Correct 487 ms 54740 KB Output is correct
156 Correct 698 ms 74436 KB Output is correct
157 Correct 1 ms 348 KB Output is correct
158 Correct 1 ms 348 KB Output is correct
159 Correct 0 ms 348 KB Output is correct
160 Correct 0 ms 348 KB Output is correct
161 Incorrect 2021 ms 60864 KB Solution announced impossible, but it is possible.
162 Halted 0 ms 0 KB -