Submission #1097215

# Submission time Handle Problem Language Result Execution time Memory
1097215 2024-10-06T12:32:46 Z abczz Fountain Parks (IOI21_parks) C++17
70 / 100
1394 ms 142496 KB
#include "parks.h"
#include <iostream>
#include <map>
#include <array>
#include <queue>
#define ll long long
 
using namespace std;
 
map <array<ll, 2>, ll> mp;
map <array<ll, 2>, ll> visited;
map <array<ll, 2>, ll> pt;
map <array<ll, 3>, ll> edge;
queue <array<ll, 2>> Q;
vector <int> U, V, A, B;
ll dj[4][2] = {-1, -1, -1, 1, 1, 1, 1, -1}, dk[4][2] = {-2, 0, 0, 2, 2, 0, 0, -2};
 
void dfs(ll u, ll v) {
    ++visited[{u, v}];
    for (int i=0; i<4; ++i) {
        ll nx = u + dk[i][0], ny = v + dk[i][1];
        if (pt.count({nx, ny}) && !visited.count({nx, ny})) dfs(nx, ny);
    }
}
 
void solve(ll u, ll v) {
    for (int i=0; i<4; ++i) {
        if (edge.count({u, v, i})) {
            if (visited.count({u, v})) break;
            ++visited[{u, v}];
            U.push_back(pt[{u + dj[i][0], v + dj[i][1]}]);
            V.push_back(pt[{u + dj[(i+1)%4][0], v + dj[(i+1)%4][1]}]);
            A.push_back(u);
            B.push_back(v);
            edge.erase({u, v, i});
            edge.erase({u + dk[i][0], v + dk[i][1], i ^ 2});
            solve(u + dk[i][0], v + dk[i][1]);
            break;
        }
    }
}
 
int construct_roads(std::vector<int> x, std::vector<int> y) {
    ll n = x.size();
    for (int i=0; i<n; ++i) {
        pt[{x[i], y[i]}] = i;
        for (int j=0; j<4; ++j) {
            ll nx = x[i] + dj[j][0], ny = y[i] + dj[j][1];
            ++mp[{nx, ny}];
        }
    }
    dfs(x[0], y[0]);
    if (visited.size() != pt.size()) return 0;
    for (auto it = mp.begin(); it != mp.end();) {
        auto nx = next(it);
        auto [u, v] = it->first;
        ll tot = 0;
        for (int i=0; i<4; ++i) {
            if (pt.count({u + dj[i][0], v + dj[i][1]}) && pt.count({u + dj[(i+1)%4][0], v + dj[(i+1)%4][1]})) {
                ++tot;
                ++edge[{u, v, i}];
            }
        }
        mp[{u, v}] = tot;
        if (tot == 0) mp.erase(it);
        else if (tot == 1) Q.push({u, v});
        it = nx;
    }
    while (!Q.empty()) {
        auto [u, v] = Q.front();
        Q.pop();
        if (!mp.count({u, v})) continue;
        for (int i=0; i<4; ++i) {
            if (edge.count({u, v, i})) {
                U.push_back(pt[{u + dj[i][0], v + dj[i][1]}]);
                V.push_back(pt[{u + dj[(i+1)%4][0], v + dj[(i+1)%4][1]}]);
                edge.erase({u, v, i});
                edge.erase({u + dk[i][0], v + dk[i][1], i ^ 2});
                --mp[{u + dk[i][0], v + dk[i][1]}];
                if (mp[{u + dk[i][0], v + dk[i][1]}] == 1) Q.push({u + dk[i][0], v + dk[i][1]});
                else if (mp[{u + dk[i][0], v + dk[i][1]}] == 0) mp.erase({u + dk[i][0], v + dk[i][1]});
            }
        }
        mp.erase({u, v});
        A.push_back(u);
        B.push_back(v);
    }
    for (auto [y, z] : mp) {
        auto [u, v] = y;
        if (z == 4) Q.push({u, v});
    }
    bool ok = 0;
    ll s = 0;
    for (auto [y, z] : mp) {
        if (z == 4) ok = 1;
        else if (z == 3) ++s;
    }
    if (ok && !s) return 0;
    for (auto [y, z] : mp) {
        auto [u, v] = y;
        if (z == 4) {
            for (int i=0; i<4; ++i) {
                if (edge.count({u, v, i})) {
                    edge.erase({u, v, i});
                    edge.erase({u + dk[i][0], v + dk[i][1], i ^ 2});
                    --mp[{u, v}];
                    break;
                }
            }
        }
    }
    visited.clear();
    for (auto [y, z] : mp) {
        auto [u, v] = y;
        solve(u, v);
    }
    build(U, V, A, B);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 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 444 ms 60512 KB Output is correct
10 Correct 37 ms 6480 KB Output is correct
11 Correct 254 ms 33232 KB Output is correct
12 Correct 52 ms 9556 KB Output is correct
13 Correct 62 ms 15440 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 439 ms 54636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 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 444 ms 60512 KB Output is correct
10 Correct 37 ms 6480 KB Output is correct
11 Correct 254 ms 33232 KB Output is correct
12 Correct 52 ms 9556 KB Output is correct
13 Correct 62 ms 15440 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 439 ms 54636 KB Output is correct
17 Correct 1 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 0 ms 344 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1242 ms 129852 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 4 ms 1112 KB Output is correct
26 Correct 3 ms 1228 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 413 ms 53632 KB Output is correct
29 Correct 715 ms 80592 KB Output is correct
30 Correct 1064 ms 110140 KB Output is correct
31 Correct 1306 ms 127056 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 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 0 ms 344 KB Output is correct
43 Correct 2 ms 860 KB Output is correct
44 Correct 3 ms 984 KB Output is correct
45 Correct 454 ms 53964 KB Output is correct
46 Correct 753 ms 79752 KB Output is correct
47 Correct 777 ms 78284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 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 444 ms 60512 KB Output is correct
10 Correct 37 ms 6480 KB Output is correct
11 Correct 254 ms 33232 KB Output is correct
12 Correct 52 ms 9556 KB Output is correct
13 Correct 62 ms 15440 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 439 ms 54636 KB Output is correct
17 Correct 1 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 0 ms 344 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1242 ms 129852 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 4 ms 1112 KB Output is correct
26 Correct 3 ms 1228 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 413 ms 53632 KB Output is correct
29 Correct 715 ms 80592 KB Output is correct
30 Correct 1064 ms 110140 KB Output is correct
31 Correct 1306 ms 127056 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 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 0 ms 344 KB Output is correct
43 Correct 2 ms 860 KB Output is correct
44 Correct 3 ms 984 KB Output is correct
45 Correct 454 ms 53964 KB Output is correct
46 Correct 753 ms 79752 KB Output is correct
47 Correct 777 ms 78284 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 600 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 1394 ms 131068 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 6 ms 1372 KB Output is correct
58 Correct 23 ms 4184 KB Output is correct
59 Correct 11 ms 2396 KB Output is correct
60 Correct 603 ms 65968 KB Output is correct
61 Correct 827 ms 90376 KB Output is correct
62 Correct 1006 ms 108408 KB Output is correct
63 Correct 1335 ms 130164 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 344 KB Output is correct
67 Correct 1109 ms 116424 KB Output is correct
68 Correct 1148 ms 117068 KB Output is correct
69 Correct 1020 ms 118804 KB Output is correct
70 Correct 5 ms 1368 KB Output is correct
71 Correct 8 ms 2136 KB Output is correct
72 Correct 497 ms 49560 KB Output is correct
73 Correct 857 ms 78080 KB Output is correct
74 Correct 1228 ms 102564 KB Output is correct
75 Correct 1148 ms 119788 KB Output is correct
76 Correct 1002 ms 124688 KB Output is correct
77 Correct 6 ms 1624 KB Output is correct
78 Correct 10 ms 2652 KB Output is correct
79 Correct 483 ms 53772 KB Output is correct
80 Correct 802 ms 82964 KB Output is correct
81 Correct 1283 ms 109104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 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 444 ms 60512 KB Output is correct
10 Correct 37 ms 6480 KB Output is correct
11 Correct 254 ms 33232 KB Output is correct
12 Correct 52 ms 9556 KB Output is correct
13 Correct 62 ms 15440 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 439 ms 54636 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 1060 ms 118380 KB Output is correct
21 Correct 1037 ms 112768 KB Output is correct
22 Correct 987 ms 110788 KB Output is correct
23 Correct 777 ms 98788 KB Output is correct
24 Correct 372 ms 67128 KB Output is correct
25 Correct 336 ms 42068 KB Output is correct
26 Correct 300 ms 42056 KB Output is correct
27 Correct 1025 ms 98768 KB Output is correct
28 Correct 979 ms 98716 KB Output is correct
29 Correct 1190 ms 97700 KB Output is correct
30 Correct 1124 ms 98148 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 55 ms 7932 KB Output is correct
33 Correct 130 ms 27732 KB Output is correct
34 Correct 965 ms 115236 KB Output is correct
35 Correct 13 ms 2648 KB Output is correct
36 Correct 64 ms 10916 KB Output is correct
37 Correct 146 ms 20304 KB Output is correct
38 Correct 419 ms 36156 KB Output is correct
39 Correct 601 ms 49120 KB Output is correct
40 Correct 754 ms 61544 KB Output is correct
41 Correct 951 ms 75756 KB Output is correct
42 Correct 1167 ms 89908 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 0 ms 344 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 2 ms 860 KB Output is correct
55 Correct 3 ms 1112 KB Output is correct
56 Correct 482 ms 54824 KB Output is correct
57 Correct 855 ms 80560 KB Output is correct
58 Correct 754 ms 79304 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 968 ms 117544 KB Output is correct
63 Correct 1053 ms 118064 KB Output is correct
64 Correct 1120 ms 119836 KB Output is correct
65 Correct 5 ms 1452 KB Output is correct
66 Correct 9 ms 2140 KB Output is correct
67 Correct 497 ms 50240 KB Output is correct
68 Correct 804 ms 78820 KB Output is correct
69 Correct 1206 ms 103796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 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 444 ms 60512 KB Output is correct
10 Correct 37 ms 6480 KB Output is correct
11 Correct 254 ms 33232 KB Output is correct
12 Correct 52 ms 9556 KB Output is correct
13 Correct 62 ms 15440 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 439 ms 54636 KB Output is correct
17 Correct 1071 ms 126408 KB Output is correct
18 Correct 1082 ms 123032 KB Output is correct
19 Correct 1184 ms 117664 KB Output is correct
20 Correct 1185 ms 117180 KB Output is correct
21 Correct 983 ms 99524 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 131 ms 15820 KB Output is correct
24 Correct 27 ms 5384 KB Output is correct
25 Correct 94 ms 14676 KB Output is correct
26 Correct 180 ms 23636 KB Output is correct
27 Correct 612 ms 56016 KB Output is correct
28 Correct 860 ms 68948 KB Output is correct
29 Correct 1108 ms 84120 KB Output is correct
30 Correct 1143 ms 97432 KB Output is correct
31 Correct 1366 ms 111676 KB Output is correct
32 Correct 1248 ms 120800 KB Output is correct
33 Correct 1084 ms 125796 KB Output is correct
34 Correct 6 ms 1628 KB Output is correct
35 Correct 11 ms 2752 KB Output is correct
36 Correct 531 ms 54608 KB Output is correct
37 Correct 810 ms 83968 KB Output is correct
38 Correct 1146 ms 110256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 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 444 ms 60512 KB Output is correct
10 Correct 37 ms 6480 KB Output is correct
11 Correct 254 ms 33232 KB Output is correct
12 Correct 52 ms 9556 KB Output is correct
13 Correct 62 ms 15440 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 439 ms 54636 KB Output is correct
17 Correct 1 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 0 ms 344 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1242 ms 129852 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 4 ms 1112 KB Output is correct
26 Correct 3 ms 1228 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 413 ms 53632 KB Output is correct
29 Correct 715 ms 80592 KB Output is correct
30 Correct 1064 ms 110140 KB Output is correct
31 Correct 1306 ms 127056 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 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 0 ms 344 KB Output is correct
43 Correct 2 ms 860 KB Output is correct
44 Correct 3 ms 984 KB Output is correct
45 Correct 454 ms 53964 KB Output is correct
46 Correct 753 ms 79752 KB Output is correct
47 Correct 777 ms 78284 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 600 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 1394 ms 131068 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 6 ms 1372 KB Output is correct
58 Correct 23 ms 4184 KB Output is correct
59 Correct 11 ms 2396 KB Output is correct
60 Correct 603 ms 65968 KB Output is correct
61 Correct 827 ms 90376 KB Output is correct
62 Correct 1006 ms 108408 KB Output is correct
63 Correct 1335 ms 130164 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 344 KB Output is correct
67 Correct 1109 ms 116424 KB Output is correct
68 Correct 1148 ms 117068 KB Output is correct
69 Correct 1020 ms 118804 KB Output is correct
70 Correct 5 ms 1368 KB Output is correct
71 Correct 8 ms 2136 KB Output is correct
72 Correct 497 ms 49560 KB Output is correct
73 Correct 857 ms 78080 KB Output is correct
74 Correct 1228 ms 102564 KB Output is correct
75 Correct 1148 ms 119788 KB Output is correct
76 Correct 1002 ms 124688 KB Output is correct
77 Correct 6 ms 1624 KB Output is correct
78 Correct 10 ms 2652 KB Output is correct
79 Correct 483 ms 53772 KB Output is correct
80 Correct 802 ms 82964 KB Output is correct
81 Correct 1283 ms 109104 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 1060 ms 118380 KB Output is correct
86 Correct 1037 ms 112768 KB Output is correct
87 Correct 987 ms 110788 KB Output is correct
88 Correct 777 ms 98788 KB Output is correct
89 Correct 372 ms 67128 KB Output is correct
90 Correct 336 ms 42068 KB Output is correct
91 Correct 300 ms 42056 KB Output is correct
92 Correct 1025 ms 98768 KB Output is correct
93 Correct 979 ms 98716 KB Output is correct
94 Correct 1190 ms 97700 KB Output is correct
95 Correct 1124 ms 98148 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 55 ms 7932 KB Output is correct
98 Correct 130 ms 27732 KB Output is correct
99 Correct 965 ms 115236 KB Output is correct
100 Correct 13 ms 2648 KB Output is correct
101 Correct 64 ms 10916 KB Output is correct
102 Correct 146 ms 20304 KB Output is correct
103 Correct 419 ms 36156 KB Output is correct
104 Correct 601 ms 49120 KB Output is correct
105 Correct 754 ms 61544 KB Output is correct
106 Correct 951 ms 75756 KB Output is correct
107 Correct 1167 ms 89908 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 0 ms 348 KB Output is correct
110 Correct 0 ms 344 KB Output is correct
111 Correct 1 ms 348 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 1 ms 348 KB Output is correct
114 Correct 0 ms 348 KB Output is correct
115 Correct 1 ms 348 KB Output is correct
116 Correct 0 ms 344 KB Output is correct
117 Correct 0 ms 344 KB Output is correct
118 Correct 0 ms 348 KB Output is correct
119 Correct 2 ms 860 KB Output is correct
120 Correct 3 ms 1112 KB Output is correct
121 Correct 482 ms 54824 KB Output is correct
122 Correct 855 ms 80560 KB Output is correct
123 Correct 754 ms 79304 KB Output is correct
124 Correct 0 ms 344 KB Output is correct
125 Correct 0 ms 348 KB Output is correct
126 Correct 1 ms 344 KB Output is correct
127 Correct 968 ms 117544 KB Output is correct
128 Correct 1053 ms 118064 KB Output is correct
129 Correct 1120 ms 119836 KB Output is correct
130 Correct 5 ms 1452 KB Output is correct
131 Correct 9 ms 2140 KB Output is correct
132 Correct 497 ms 50240 KB Output is correct
133 Correct 804 ms 78820 KB Output is correct
134 Correct 1206 ms 103796 KB Output is correct
135 Correct 1071 ms 126408 KB Output is correct
136 Correct 1082 ms 123032 KB Output is correct
137 Correct 1184 ms 117664 KB Output is correct
138 Correct 1185 ms 117180 KB Output is correct
139 Correct 983 ms 99524 KB Output is correct
140 Correct 0 ms 344 KB Output is correct
141 Correct 131 ms 15820 KB Output is correct
142 Correct 27 ms 5384 KB Output is correct
143 Correct 94 ms 14676 KB Output is correct
144 Correct 180 ms 23636 KB Output is correct
145 Correct 612 ms 56016 KB Output is correct
146 Correct 860 ms 68948 KB Output is correct
147 Correct 1108 ms 84120 KB Output is correct
148 Correct 1143 ms 97432 KB Output is correct
149 Correct 1366 ms 111676 KB Output is correct
150 Correct 1248 ms 120800 KB Output is correct
151 Correct 1084 ms 125796 KB Output is correct
152 Correct 6 ms 1628 KB Output is correct
153 Correct 11 ms 2752 KB Output is correct
154 Correct 531 ms 54608 KB Output is correct
155 Correct 810 ms 83968 KB Output is correct
156 Correct 1146 ms 110256 KB Output is correct
157 Correct 0 ms 344 KB Output is correct
158 Correct 0 ms 348 KB Output is correct
159 Correct 1 ms 348 KB Output is correct
160 Correct 0 ms 348 KB Output is correct
161 Correct 1331 ms 142496 KB Output is correct
162 Correct 952 ms 112084 KB Output is correct
163 Incorrect 807 ms 106464 KB Solution announced impossible, but it is possible.
164 Halted 0 ms 0 KB -