#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct dsu {
int n;
vector<int> p, s;
dsu(int n) : n(n), p(n), s(n, 1) {
iota(p.begin(), p.end(), 0);
}
int find(int x) {
return x == p[x] ? x : p[x] = find(p[x]);
}
int size(int x) {
return s[find(x)];
}
bool same(int x, int y) {
return find(x) == find(y);
}
bool unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y) {
return 0;
}
if (s[x] > s[y]) {
swap(x, y);
}
p[x] = y;
s[y] += s[x];
return 1;
}
};
constexpr int A = 200000;
struct road {
int a, b, c;
pair<int, int> t[2];
road() {
}
road(int A, int B, int C, pair<int, int> U, pair<int, int> V) {
a = A, b = B, c = C, t[0] = U, t[1] = V;
}
};
int construct_roads(vector<int> X, vector<int> Y) {
int N = X.size();
if (*max_element(X.begin(), X.end()) <= 6) {
vector f(7, vector(A + 3, -1));
for (int i = 0; i < N; i++) {
f[X[i]][Y[i]] = i;
}
dsu uf(N);
vector<int> u, v, a, b, m(A + 1, -1), l(A + 1, -1), r(A + 1, -1);
for (int y = 2; y <= A; y += 2) {
for (int x = 2; x <= 6; x += 2) {
if (f[x][y] != -1 && f[x][y + 2] != -1) {
if (x == 4) {
m[y + 1] = u.size();
}
u.push_back(f[x][y]);
v.push_back(f[x][y + 2]);
a.push_back(x == 2 ? 1 : 7);
b.push_back(y + 1);
uf.unite(f[x][y], f[x][y + 2]);
}
if (x != 6 && f[x][y] != -1 && f[x + 2][y] != -1) {
if (x == 2 && l[y - 2] == -1) {
l[y] = u.size();
u.push_back(f[x][y]);
v.push_back(f[x + 2][y]);
a.push_back(3);
b.push_back(-1);
uf.unite(f[x][y], f[x + 2][y]);
}
if (x == 4 && r[y - 2] == -1) {
r[y] = u.size();
u.push_back(f[x][y]);
v.push_back(f[x + 2][y]);
a.push_back(5);
b.push_back(-1);
uf.unite(f[x][y], f[x + 2][y]);
}
}
}
}
if (uf.size(0) != N) {
return 0;
}
vector<int> q(A, -1), s(A, -1), t(A, -1);
for (int i = 1; i <= A; i++) {
if (i % 2 == 1 && m[i] != -1) {
if (s[i - 1] != 1) {
a[m[i]] = 3;
q[i] = 0;
} else {
assert(t[i - 1] != 1);
a[m[i]] = 5;
q[i] = 1;
}
}
if (i % 2 == 0) {
if (l[i] != -1) {
if (q[i - 1] == 0) {
b[l[i]] = i + 1;
s[i] = 1;
} else {
b[l[i]] = i - 1;
s[i] = 0;
}
}
if (r[i] != -1) {
if (q[i - 1] == 1) {
b[r[i]] = i + 1;
t[i] = 1;
} else {
b[r[i]] = i - 1;
t[i] = 0;
}
}
}
}
build(u, v, a, b);
return 1;
}
map<int, int> mp[A + 1];
for (int i = 0; i < N; i++) {
mp[X[i]][Y[i]] = i;
}
dsu uf(N);
vector<road> roads;
for (int i = 0; i < N; i++) {
for (int dx = -2; dx <= 2; dx += 4) {
if (X[i] + dx < 0 || X[i] + dx > A) {
continue;
}
if (mp[X[i] + dx].count(Y[i])) {
int j = mp[X[i] + dx][Y[i]];
if (!uf.same(i, j)) {
uf.unite(i, j);
roads.push_back(road(i, j, -1, pair{X[i] + dx / 2, Y[i] + 1}, pair{X[i] + dx / 2, Y[i] - 1}));
}
}
}
for (int dy = -2; dy <= 2; dy += 4) {
if (Y[i] + dy < 0 || Y[i] + dy > A) {
continue;
}
if (mp[X[i]].count(Y[i] + dy)) {
int j = mp[X[i]][Y[i] + dy];
if (!uf.same(i, j)) {
uf.unite(i, j);
roads.push_back(road(i, j, -1, pair{X[i] - 1, Y[i] + dy / 2}, pair{X[i] + 1, Y[i] + dy / 2}));
}
}
}
}
if (uf.size(0) != N) {
return 0;
}
map<int, vector<pair<int, int>>> f[A + 3];
for (int z = 0; z < roads.size(); z++) {
auto r = roads[z];
for (int i = 0; i < 2; i++) {
auto [x, y] = r.t[i];
f[x][y].emplace_back(z, i);
}
}
for (int z = 0; z < roads.size(); z++) {
if (roads[z].c != -1) {
continue;
}
for (int d = 0; d < 2; d++) {
bool ok = 1;
vector<int> q;
roads[z].c = d;
q.push_back(z);
for (int i = 0; ok && i < q.size(); i++) {
int u = q[i];
int color = roads[u].c;
auto [x, y] = roads[u].t[color];
for (auto [v, w] : f[x][y]) {
if (roads[v].c == -1) {
roads[v].c = 1 - w;
q.push_back(v);
}
if (v != u && roads[v].c == w) {
ok = 0;
break;
}
}
}
if (ok) {
break;
}
if (!ok) {
if (d == 1) {
return 0;
}
for (int x : q) {
roads[x].c = -1;
}
}
}
}
vector<int> u, v, a, b;
for (auto r : roads) {
u.push_back(r.a);
v.push_back(r.b);
auto [x, y] = r.t[r.c];
a.push_back(x);
b.push_back(y);
}
build(u, v, a, b);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:160:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<road>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
160 | for (int z = 0; z < roads.size(); z++) {
| ~~^~~~~~~~~~~~~~
parks.cpp:167:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<road>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
167 | for (int z = 0; z < roads.size(); z++) {
| ~~^~~~~~~~~~~~~~
parks.cpp:176:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
176 | for (int i = 0; ok && i < q.size(); i++) {
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
29252 KB |
Output is correct |
2 |
Correct |
15 ms |
29268 KB |
Output is correct |
3 |
Correct |
11 ms |
26820 KB |
Output is correct |
4 |
Correct |
11 ms |
29192 KB |
Output is correct |
5 |
Correct |
11 ms |
29252 KB |
Output is correct |
6 |
Correct |
11 ms |
26820 KB |
Output is correct |
7 |
Correct |
11 ms |
26820 KB |
Output is correct |
8 |
Correct |
11 ms |
26916 KB |
Output is correct |
9 |
Correct |
68 ms |
36700 KB |
Output is correct |
10 |
Correct |
20 ms |
30080 KB |
Output is correct |
11 |
Correct |
32 ms |
33144 KB |
Output is correct |
12 |
Correct |
17 ms |
30276 KB |
Output is correct |
13 |
Correct |
17 ms |
29312 KB |
Output is correct |
14 |
Correct |
10 ms |
26992 KB |
Output is correct |
15 |
Correct |
11 ms |
26948 KB |
Output is correct |
16 |
Correct |
60 ms |
36700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
29252 KB |
Output is correct |
2 |
Correct |
15 ms |
29268 KB |
Output is correct |
3 |
Correct |
11 ms |
26820 KB |
Output is correct |
4 |
Correct |
11 ms |
29192 KB |
Output is correct |
5 |
Correct |
11 ms |
29252 KB |
Output is correct |
6 |
Correct |
11 ms |
26820 KB |
Output is correct |
7 |
Correct |
11 ms |
26820 KB |
Output is correct |
8 |
Correct |
11 ms |
26916 KB |
Output is correct |
9 |
Correct |
68 ms |
36700 KB |
Output is correct |
10 |
Correct |
20 ms |
30080 KB |
Output is correct |
11 |
Correct |
32 ms |
33144 KB |
Output is correct |
12 |
Correct |
17 ms |
30276 KB |
Output is correct |
13 |
Correct |
17 ms |
29312 KB |
Output is correct |
14 |
Correct |
10 ms |
26992 KB |
Output is correct |
15 |
Correct |
11 ms |
26948 KB |
Output is correct |
16 |
Correct |
60 ms |
36700 KB |
Output is correct |
17 |
Correct |
11 ms |
29240 KB |
Output is correct |
18 |
Correct |
13 ms |
29252 KB |
Output is correct |
19 |
Correct |
13 ms |
29252 KB |
Output is correct |
20 |
Correct |
12 ms |
29220 KB |
Output is correct |
21 |
Correct |
11 ms |
26836 KB |
Output is correct |
22 |
Correct |
11 ms |
29288 KB |
Output is correct |
23 |
Correct |
119 ms |
46076 KB |
Output is correct |
24 |
Correct |
13 ms |
29252 KB |
Output is correct |
25 |
Correct |
13 ms |
29380 KB |
Output is correct |
26 |
Correct |
13 ms |
27044 KB |
Output is correct |
27 |
Correct |
12 ms |
27172 KB |
Output is correct |
28 |
Correct |
65 ms |
36276 KB |
Output is correct |
29 |
Correct |
71 ms |
39824 KB |
Output is correct |
30 |
Correct |
91 ms |
42968 KB |
Output is correct |
31 |
Correct |
110 ms |
46140 KB |
Output is correct |
32 |
Correct |
12 ms |
29252 KB |
Output is correct |
33 |
Correct |
14 ms |
29252 KB |
Output is correct |
34 |
Correct |
11 ms |
29252 KB |
Output is correct |
35 |
Correct |
10 ms |
26820 KB |
Output is correct |
36 |
Correct |
11 ms |
26820 KB |
Output is correct |
37 |
Correct |
15 ms |
29252 KB |
Output is correct |
38 |
Correct |
13 ms |
29164 KB |
Output is correct |
39 |
Correct |
12 ms |
29252 KB |
Output is correct |
40 |
Correct |
12 ms |
29176 KB |
Output is correct |
41 |
Correct |
11 ms |
26856 KB |
Output is correct |
42 |
Correct |
12 ms |
29224 KB |
Output is correct |
43 |
Correct |
14 ms |
26948 KB |
Output is correct |
44 |
Correct |
11 ms |
27076 KB |
Output is correct |
45 |
Correct |
53 ms |
36684 KB |
Output is correct |
46 |
Correct |
77 ms |
40248 KB |
Output is correct |
47 |
Correct |
88 ms |
40196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
29252 KB |
Output is correct |
2 |
Correct |
15 ms |
29268 KB |
Output is correct |
3 |
Correct |
11 ms |
26820 KB |
Output is correct |
4 |
Correct |
11 ms |
29192 KB |
Output is correct |
5 |
Correct |
11 ms |
29252 KB |
Output is correct |
6 |
Correct |
11 ms |
26820 KB |
Output is correct |
7 |
Correct |
11 ms |
26820 KB |
Output is correct |
8 |
Correct |
11 ms |
26916 KB |
Output is correct |
9 |
Correct |
68 ms |
36700 KB |
Output is correct |
10 |
Correct |
20 ms |
30080 KB |
Output is correct |
11 |
Correct |
32 ms |
33144 KB |
Output is correct |
12 |
Correct |
17 ms |
30276 KB |
Output is correct |
13 |
Correct |
17 ms |
29312 KB |
Output is correct |
14 |
Correct |
10 ms |
26992 KB |
Output is correct |
15 |
Correct |
11 ms |
26948 KB |
Output is correct |
16 |
Correct |
60 ms |
36700 KB |
Output is correct |
17 |
Correct |
11 ms |
29240 KB |
Output is correct |
18 |
Correct |
13 ms |
29252 KB |
Output is correct |
19 |
Correct |
13 ms |
29252 KB |
Output is correct |
20 |
Correct |
12 ms |
29220 KB |
Output is correct |
21 |
Correct |
11 ms |
26836 KB |
Output is correct |
22 |
Correct |
11 ms |
29288 KB |
Output is correct |
23 |
Correct |
119 ms |
46076 KB |
Output is correct |
24 |
Correct |
13 ms |
29252 KB |
Output is correct |
25 |
Correct |
13 ms |
29380 KB |
Output is correct |
26 |
Correct |
13 ms |
27044 KB |
Output is correct |
27 |
Correct |
12 ms |
27172 KB |
Output is correct |
28 |
Correct |
65 ms |
36276 KB |
Output is correct |
29 |
Correct |
71 ms |
39824 KB |
Output is correct |
30 |
Correct |
91 ms |
42968 KB |
Output is correct |
31 |
Correct |
110 ms |
46140 KB |
Output is correct |
32 |
Correct |
12 ms |
29252 KB |
Output is correct |
33 |
Correct |
14 ms |
29252 KB |
Output is correct |
34 |
Correct |
11 ms |
29252 KB |
Output is correct |
35 |
Correct |
10 ms |
26820 KB |
Output is correct |
36 |
Correct |
11 ms |
26820 KB |
Output is correct |
37 |
Correct |
15 ms |
29252 KB |
Output is correct |
38 |
Correct |
13 ms |
29164 KB |
Output is correct |
39 |
Correct |
12 ms |
29252 KB |
Output is correct |
40 |
Correct |
12 ms |
29176 KB |
Output is correct |
41 |
Correct |
11 ms |
26856 KB |
Output is correct |
42 |
Correct |
12 ms |
29224 KB |
Output is correct |
43 |
Correct |
14 ms |
26948 KB |
Output is correct |
44 |
Correct |
11 ms |
27076 KB |
Output is correct |
45 |
Correct |
53 ms |
36684 KB |
Output is correct |
46 |
Correct |
77 ms |
40248 KB |
Output is correct |
47 |
Correct |
88 ms |
40196 KB |
Output is correct |
48 |
Correct |
12 ms |
29252 KB |
Output is correct |
49 |
Correct |
11 ms |
29212 KB |
Output is correct |
50 |
Correct |
11 ms |
29204 KB |
Output is correct |
51 |
Correct |
11 ms |
29224 KB |
Output is correct |
52 |
Correct |
11 ms |
29260 KB |
Output is correct |
53 |
Correct |
14 ms |
29252 KB |
Output is correct |
54 |
Correct |
13 ms |
29184 KB |
Output is correct |
55 |
Correct |
115 ms |
46556 KB |
Output is correct |
56 |
Correct |
11 ms |
29236 KB |
Output is correct |
57 |
Correct |
12 ms |
29480 KB |
Output is correct |
58 |
Correct |
14 ms |
29836 KB |
Output is correct |
59 |
Correct |
12 ms |
27596 KB |
Output is correct |
60 |
Correct |
74 ms |
38692 KB |
Output is correct |
61 |
Correct |
79 ms |
41432 KB |
Output is correct |
62 |
Correct |
102 ms |
43904 KB |
Output is correct |
63 |
Correct |
116 ms |
46604 KB |
Output is correct |
64 |
Correct |
11 ms |
26820 KB |
Output is correct |
65 |
Correct |
11 ms |
29252 KB |
Output is correct |
66 |
Correct |
13 ms |
26868 KB |
Output is correct |
67 |
Correct |
94 ms |
43940 KB |
Output is correct |
68 |
Correct |
99 ms |
43964 KB |
Output is correct |
69 |
Correct |
114 ms |
43820 KB |
Output is correct |
70 |
Correct |
13 ms |
27076 KB |
Output is correct |
71 |
Correct |
13 ms |
27368 KB |
Output is correct |
72 |
Correct |
53 ms |
36668 KB |
Output is correct |
73 |
Correct |
75 ms |
40508 KB |
Output is correct |
74 |
Correct |
102 ms |
43936 KB |
Output is correct |
75 |
Correct |
108 ms |
45700 KB |
Output is correct |
76 |
Correct |
96 ms |
43876 KB |
Output is correct |
77 |
Correct |
13 ms |
27244 KB |
Output is correct |
78 |
Correct |
13 ms |
27460 KB |
Output is correct |
79 |
Correct |
55 ms |
37060 KB |
Output is correct |
80 |
Correct |
78 ms |
41204 KB |
Output is correct |
81 |
Correct |
139 ms |
44860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
29252 KB |
Output is correct |
2 |
Correct |
15 ms |
29268 KB |
Output is correct |
3 |
Correct |
11 ms |
26820 KB |
Output is correct |
4 |
Correct |
11 ms |
29192 KB |
Output is correct |
5 |
Correct |
11 ms |
29252 KB |
Output is correct |
6 |
Correct |
11 ms |
26820 KB |
Output is correct |
7 |
Correct |
11 ms |
26820 KB |
Output is correct |
8 |
Correct |
11 ms |
26916 KB |
Output is correct |
9 |
Correct |
68 ms |
36700 KB |
Output is correct |
10 |
Correct |
20 ms |
30080 KB |
Output is correct |
11 |
Correct |
32 ms |
33144 KB |
Output is correct |
12 |
Correct |
17 ms |
30276 KB |
Output is correct |
13 |
Correct |
17 ms |
29312 KB |
Output is correct |
14 |
Correct |
10 ms |
26992 KB |
Output is correct |
15 |
Correct |
11 ms |
26948 KB |
Output is correct |
16 |
Correct |
60 ms |
36700 KB |
Output is correct |
17 |
Correct |
11 ms |
19028 KB |
Output is correct |
18 |
Correct |
10 ms |
19028 KB |
Output is correct |
19 |
Correct |
8 ms |
19028 KB |
Output is correct |
20 |
Correct |
371 ms |
73232 KB |
Output is correct |
21 |
Correct |
400 ms |
73004 KB |
Output is correct |
22 |
Correct |
398 ms |
72976 KB |
Output is correct |
23 |
Correct |
416 ms |
83764 KB |
Output is correct |
24 |
Correct |
164 ms |
35020 KB |
Output is correct |
25 |
Correct |
274 ms |
42124 KB |
Output is correct |
26 |
Correct |
200 ms |
42076 KB |
Output is correct |
27 |
Correct |
586 ms |
94132 KB |
Output is correct |
28 |
Correct |
552 ms |
94072 KB |
Output is correct |
29 |
Correct |
675 ms |
94136 KB |
Output is correct |
30 |
Correct |
647 ms |
94052 KB |
Output is correct |
31 |
Correct |
10 ms |
19028 KB |
Output is correct |
32 |
Correct |
31 ms |
23228 KB |
Output is correct |
33 |
Correct |
43 ms |
27308 KB |
Output is correct |
34 |
Correct |
349 ms |
73152 KB |
Output is correct |
35 |
Correct |
16 ms |
20392 KB |
Output is correct |
36 |
Correct |
58 ms |
25224 KB |
Output is correct |
37 |
Correct |
94 ms |
31044 KB |
Output is correct |
38 |
Correct |
171 ms |
42732 KB |
Output is correct |
39 |
Correct |
249 ms |
50876 KB |
Output is correct |
40 |
Correct |
343 ms |
60780 KB |
Output is correct |
41 |
Correct |
463 ms |
69024 KB |
Output is correct |
42 |
Correct |
596 ms |
77404 KB |
Output is correct |
43 |
Correct |
12 ms |
29188 KB |
Output is correct |
44 |
Correct |
12 ms |
29284 KB |
Output is correct |
45 |
Correct |
13 ms |
29280 KB |
Output is correct |
46 |
Correct |
11 ms |
26948 KB |
Output is correct |
47 |
Correct |
11 ms |
26856 KB |
Output is correct |
48 |
Correct |
12 ms |
29276 KB |
Output is correct |
49 |
Correct |
12 ms |
29232 KB |
Output is correct |
50 |
Correct |
12 ms |
29208 KB |
Output is correct |
51 |
Correct |
12 ms |
29204 KB |
Output is correct |
52 |
Correct |
11 ms |
26820 KB |
Output is correct |
53 |
Correct |
12 ms |
29252 KB |
Output is correct |
54 |
Correct |
11 ms |
27000 KB |
Output is correct |
55 |
Correct |
11 ms |
27056 KB |
Output is correct |
56 |
Correct |
53 ms |
37536 KB |
Output is correct |
57 |
Correct |
72 ms |
41276 KB |
Output is correct |
58 |
Correct |
73 ms |
41276 KB |
Output is correct |
59 |
Correct |
11 ms |
26820 KB |
Output is correct |
60 |
Correct |
12 ms |
29252 KB |
Output is correct |
61 |
Correct |
11 ms |
26820 KB |
Output is correct |
62 |
Correct |
95 ms |
45492 KB |
Output is correct |
63 |
Correct |
95 ms |
45484 KB |
Output is correct |
64 |
Correct |
95 ms |
45332 KB |
Output is correct |
65 |
Correct |
12 ms |
27136 KB |
Output is correct |
66 |
Correct |
13 ms |
27304 KB |
Output is correct |
67 |
Correct |
52 ms |
37416 KB |
Output is correct |
68 |
Correct |
74 ms |
41684 KB |
Output is correct |
69 |
Correct |
109 ms |
45484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
29252 KB |
Output is correct |
2 |
Correct |
15 ms |
29268 KB |
Output is correct |
3 |
Correct |
11 ms |
26820 KB |
Output is correct |
4 |
Correct |
11 ms |
29192 KB |
Output is correct |
5 |
Correct |
11 ms |
29252 KB |
Output is correct |
6 |
Correct |
11 ms |
26820 KB |
Output is correct |
7 |
Correct |
11 ms |
26820 KB |
Output is correct |
8 |
Correct |
11 ms |
26916 KB |
Output is correct |
9 |
Correct |
68 ms |
36700 KB |
Output is correct |
10 |
Correct |
20 ms |
30080 KB |
Output is correct |
11 |
Correct |
32 ms |
33144 KB |
Output is correct |
12 |
Correct |
17 ms |
30276 KB |
Output is correct |
13 |
Correct |
17 ms |
29312 KB |
Output is correct |
14 |
Correct |
10 ms |
26992 KB |
Output is correct |
15 |
Correct |
11 ms |
26948 KB |
Output is correct |
16 |
Correct |
60 ms |
36700 KB |
Output is correct |
17 |
Correct |
532 ms |
92744 KB |
Output is correct |
18 |
Correct |
564 ms |
92748 KB |
Output is correct |
19 |
Correct |
397 ms |
70760 KB |
Output is correct |
20 |
Correct |
560 ms |
74532 KB |
Output is correct |
21 |
Correct |
551 ms |
77084 KB |
Output is correct |
22 |
Correct |
9 ms |
19028 KB |
Output is correct |
23 |
Correct |
66 ms |
28072 KB |
Output is correct |
24 |
Correct |
24 ms |
21640 KB |
Output is correct |
25 |
Correct |
71 ms |
27952 KB |
Output is correct |
26 |
Correct |
114 ms |
31532 KB |
Output is correct |
27 |
Correct |
247 ms |
47904 KB |
Output is correct |
28 |
Correct |
306 ms |
54400 KB |
Output is correct |
29 |
Correct |
398 ms |
62664 KB |
Output is correct |
30 |
Correct |
516 ms |
69604 KB |
Output is correct |
31 |
Correct |
602 ms |
76152 KB |
Output is correct |
32 |
Correct |
113 ms |
45964 KB |
Output is correct |
33 |
Correct |
97 ms |
44236 KB |
Output is correct |
34 |
Correct |
12 ms |
27204 KB |
Output is correct |
35 |
Correct |
13 ms |
27464 KB |
Output is correct |
36 |
Correct |
57 ms |
37320 KB |
Output is correct |
37 |
Correct |
82 ms |
41592 KB |
Output is correct |
38 |
Correct |
103 ms |
45084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
29252 KB |
Output is correct |
2 |
Correct |
15 ms |
29268 KB |
Output is correct |
3 |
Correct |
11 ms |
26820 KB |
Output is correct |
4 |
Correct |
11 ms |
29192 KB |
Output is correct |
5 |
Correct |
11 ms |
29252 KB |
Output is correct |
6 |
Correct |
11 ms |
26820 KB |
Output is correct |
7 |
Correct |
11 ms |
26820 KB |
Output is correct |
8 |
Correct |
11 ms |
26916 KB |
Output is correct |
9 |
Correct |
68 ms |
36700 KB |
Output is correct |
10 |
Correct |
20 ms |
30080 KB |
Output is correct |
11 |
Correct |
32 ms |
33144 KB |
Output is correct |
12 |
Correct |
17 ms |
30276 KB |
Output is correct |
13 |
Correct |
17 ms |
29312 KB |
Output is correct |
14 |
Correct |
10 ms |
26992 KB |
Output is correct |
15 |
Correct |
11 ms |
26948 KB |
Output is correct |
16 |
Correct |
60 ms |
36700 KB |
Output is correct |
17 |
Correct |
11 ms |
29240 KB |
Output is correct |
18 |
Correct |
13 ms |
29252 KB |
Output is correct |
19 |
Correct |
13 ms |
29252 KB |
Output is correct |
20 |
Correct |
12 ms |
29220 KB |
Output is correct |
21 |
Correct |
11 ms |
26836 KB |
Output is correct |
22 |
Correct |
11 ms |
29288 KB |
Output is correct |
23 |
Correct |
119 ms |
46076 KB |
Output is correct |
24 |
Correct |
13 ms |
29252 KB |
Output is correct |
25 |
Correct |
13 ms |
29380 KB |
Output is correct |
26 |
Correct |
13 ms |
27044 KB |
Output is correct |
27 |
Correct |
12 ms |
27172 KB |
Output is correct |
28 |
Correct |
65 ms |
36276 KB |
Output is correct |
29 |
Correct |
71 ms |
39824 KB |
Output is correct |
30 |
Correct |
91 ms |
42968 KB |
Output is correct |
31 |
Correct |
110 ms |
46140 KB |
Output is correct |
32 |
Correct |
12 ms |
29252 KB |
Output is correct |
33 |
Correct |
14 ms |
29252 KB |
Output is correct |
34 |
Correct |
11 ms |
29252 KB |
Output is correct |
35 |
Correct |
10 ms |
26820 KB |
Output is correct |
36 |
Correct |
11 ms |
26820 KB |
Output is correct |
37 |
Correct |
15 ms |
29252 KB |
Output is correct |
38 |
Correct |
13 ms |
29164 KB |
Output is correct |
39 |
Correct |
12 ms |
29252 KB |
Output is correct |
40 |
Correct |
12 ms |
29176 KB |
Output is correct |
41 |
Correct |
11 ms |
26856 KB |
Output is correct |
42 |
Correct |
12 ms |
29224 KB |
Output is correct |
43 |
Correct |
14 ms |
26948 KB |
Output is correct |
44 |
Correct |
11 ms |
27076 KB |
Output is correct |
45 |
Correct |
53 ms |
36684 KB |
Output is correct |
46 |
Correct |
77 ms |
40248 KB |
Output is correct |
47 |
Correct |
88 ms |
40196 KB |
Output is correct |
48 |
Correct |
12 ms |
29252 KB |
Output is correct |
49 |
Correct |
11 ms |
29212 KB |
Output is correct |
50 |
Correct |
11 ms |
29204 KB |
Output is correct |
51 |
Correct |
11 ms |
29224 KB |
Output is correct |
52 |
Correct |
11 ms |
29260 KB |
Output is correct |
53 |
Correct |
14 ms |
29252 KB |
Output is correct |
54 |
Correct |
13 ms |
29184 KB |
Output is correct |
55 |
Correct |
115 ms |
46556 KB |
Output is correct |
56 |
Correct |
11 ms |
29236 KB |
Output is correct |
57 |
Correct |
12 ms |
29480 KB |
Output is correct |
58 |
Correct |
14 ms |
29836 KB |
Output is correct |
59 |
Correct |
12 ms |
27596 KB |
Output is correct |
60 |
Correct |
74 ms |
38692 KB |
Output is correct |
61 |
Correct |
79 ms |
41432 KB |
Output is correct |
62 |
Correct |
102 ms |
43904 KB |
Output is correct |
63 |
Correct |
116 ms |
46604 KB |
Output is correct |
64 |
Correct |
11 ms |
26820 KB |
Output is correct |
65 |
Correct |
11 ms |
29252 KB |
Output is correct |
66 |
Correct |
13 ms |
26868 KB |
Output is correct |
67 |
Correct |
94 ms |
43940 KB |
Output is correct |
68 |
Correct |
99 ms |
43964 KB |
Output is correct |
69 |
Correct |
114 ms |
43820 KB |
Output is correct |
70 |
Correct |
13 ms |
27076 KB |
Output is correct |
71 |
Correct |
13 ms |
27368 KB |
Output is correct |
72 |
Correct |
53 ms |
36668 KB |
Output is correct |
73 |
Correct |
75 ms |
40508 KB |
Output is correct |
74 |
Correct |
102 ms |
43936 KB |
Output is correct |
75 |
Correct |
108 ms |
45700 KB |
Output is correct |
76 |
Correct |
96 ms |
43876 KB |
Output is correct |
77 |
Correct |
13 ms |
27244 KB |
Output is correct |
78 |
Correct |
13 ms |
27460 KB |
Output is correct |
79 |
Correct |
55 ms |
37060 KB |
Output is correct |
80 |
Correct |
78 ms |
41204 KB |
Output is correct |
81 |
Correct |
139 ms |
44860 KB |
Output is correct |
82 |
Correct |
11 ms |
19028 KB |
Output is correct |
83 |
Correct |
10 ms |
19028 KB |
Output is correct |
84 |
Correct |
8 ms |
19028 KB |
Output is correct |
85 |
Correct |
371 ms |
73232 KB |
Output is correct |
86 |
Correct |
400 ms |
73004 KB |
Output is correct |
87 |
Correct |
398 ms |
72976 KB |
Output is correct |
88 |
Correct |
416 ms |
83764 KB |
Output is correct |
89 |
Correct |
164 ms |
35020 KB |
Output is correct |
90 |
Correct |
274 ms |
42124 KB |
Output is correct |
91 |
Correct |
200 ms |
42076 KB |
Output is correct |
92 |
Correct |
586 ms |
94132 KB |
Output is correct |
93 |
Correct |
552 ms |
94072 KB |
Output is correct |
94 |
Correct |
675 ms |
94136 KB |
Output is correct |
95 |
Correct |
647 ms |
94052 KB |
Output is correct |
96 |
Correct |
10 ms |
19028 KB |
Output is correct |
97 |
Correct |
31 ms |
23228 KB |
Output is correct |
98 |
Correct |
43 ms |
27308 KB |
Output is correct |
99 |
Correct |
349 ms |
73152 KB |
Output is correct |
100 |
Correct |
16 ms |
20392 KB |
Output is correct |
101 |
Correct |
58 ms |
25224 KB |
Output is correct |
102 |
Correct |
94 ms |
31044 KB |
Output is correct |
103 |
Correct |
171 ms |
42732 KB |
Output is correct |
104 |
Correct |
249 ms |
50876 KB |
Output is correct |
105 |
Correct |
343 ms |
60780 KB |
Output is correct |
106 |
Correct |
463 ms |
69024 KB |
Output is correct |
107 |
Correct |
596 ms |
77404 KB |
Output is correct |
108 |
Correct |
12 ms |
29188 KB |
Output is correct |
109 |
Correct |
12 ms |
29284 KB |
Output is correct |
110 |
Correct |
13 ms |
29280 KB |
Output is correct |
111 |
Correct |
11 ms |
26948 KB |
Output is correct |
112 |
Correct |
11 ms |
26856 KB |
Output is correct |
113 |
Correct |
12 ms |
29276 KB |
Output is correct |
114 |
Correct |
12 ms |
29232 KB |
Output is correct |
115 |
Correct |
12 ms |
29208 KB |
Output is correct |
116 |
Correct |
12 ms |
29204 KB |
Output is correct |
117 |
Correct |
11 ms |
26820 KB |
Output is correct |
118 |
Correct |
12 ms |
29252 KB |
Output is correct |
119 |
Correct |
11 ms |
27000 KB |
Output is correct |
120 |
Correct |
11 ms |
27056 KB |
Output is correct |
121 |
Correct |
53 ms |
37536 KB |
Output is correct |
122 |
Correct |
72 ms |
41276 KB |
Output is correct |
123 |
Correct |
73 ms |
41276 KB |
Output is correct |
124 |
Correct |
11 ms |
26820 KB |
Output is correct |
125 |
Correct |
12 ms |
29252 KB |
Output is correct |
126 |
Correct |
11 ms |
26820 KB |
Output is correct |
127 |
Correct |
95 ms |
45492 KB |
Output is correct |
128 |
Correct |
95 ms |
45484 KB |
Output is correct |
129 |
Correct |
95 ms |
45332 KB |
Output is correct |
130 |
Correct |
12 ms |
27136 KB |
Output is correct |
131 |
Correct |
13 ms |
27304 KB |
Output is correct |
132 |
Correct |
52 ms |
37416 KB |
Output is correct |
133 |
Correct |
74 ms |
41684 KB |
Output is correct |
134 |
Correct |
109 ms |
45484 KB |
Output is correct |
135 |
Correct |
532 ms |
92744 KB |
Output is correct |
136 |
Correct |
564 ms |
92748 KB |
Output is correct |
137 |
Correct |
397 ms |
70760 KB |
Output is correct |
138 |
Correct |
560 ms |
74532 KB |
Output is correct |
139 |
Correct |
551 ms |
77084 KB |
Output is correct |
140 |
Correct |
9 ms |
19028 KB |
Output is correct |
141 |
Correct |
66 ms |
28072 KB |
Output is correct |
142 |
Correct |
24 ms |
21640 KB |
Output is correct |
143 |
Correct |
71 ms |
27952 KB |
Output is correct |
144 |
Correct |
114 ms |
31532 KB |
Output is correct |
145 |
Correct |
247 ms |
47904 KB |
Output is correct |
146 |
Correct |
306 ms |
54400 KB |
Output is correct |
147 |
Correct |
398 ms |
62664 KB |
Output is correct |
148 |
Correct |
516 ms |
69604 KB |
Output is correct |
149 |
Correct |
602 ms |
76152 KB |
Output is correct |
150 |
Correct |
113 ms |
45964 KB |
Output is correct |
151 |
Correct |
97 ms |
44236 KB |
Output is correct |
152 |
Correct |
12 ms |
27204 KB |
Output is correct |
153 |
Correct |
13 ms |
27464 KB |
Output is correct |
154 |
Correct |
57 ms |
37320 KB |
Output is correct |
155 |
Correct |
82 ms |
41592 KB |
Output is correct |
156 |
Correct |
103 ms |
45084 KB |
Output is correct |
157 |
Correct |
13 ms |
29208 KB |
Output is correct |
158 |
Correct |
12 ms |
26912 KB |
Output is correct |
159 |
Correct |
10 ms |
19036 KB |
Output is correct |
160 |
Correct |
11 ms |
18976 KB |
Output is correct |
161 |
Incorrect |
446 ms |
61736 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |