#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,sse4.2")
#endif
#include <bits/stdc++.h>
#include "parks.h"
std::unordered_map<int, int> map[100001];
int N;
std::unordered_map<int, std::vector<int>> rely[100002];
std::vector<std::pair<int, int>> vld[200000];
std::pair<int, int> assigned[200000];
std::unordered_set<int> taken[100002];
time_t stop;
std::default_random_engine Rand(std::random_device{}());
bool shuffle = true;
bool Shuffle = false;
bool doomed(int x) {
for (auto a: vld[x]) if (!taken[a.first / 2].count(a.second)) return false;
return true;
}
bool cantake(std::pair<int, int> a, int n) {
for (auto x: rely[a.first / 2][a.second]) if (x > n && doomed(x)) return false;
return true;
}
#ifdef LOCAL
size_t called = 0;
#endif
bool backtrack(int n) {
#ifdef LOCAL
called++;
#endif
if (n == N - 1) return true;
if (clock() > stop) return false;
// if (Shuffle && vld[n].size() == 2 && Rand() % 2) {
// std::swap(vld[n][0], vld[n][1]);
// }
for (auto a: vld[n]) {
if (taken[a.first / 2].count(a.second)) continue;
taken[a.first / 2].insert(a.second);
if (!cantake(a, n)) {
taken[a.first / 2].erase(a.second);
continue;
}
if (backtrack(n + 1)) {
assigned[n] = a;
return true;
}
taken[a.first / 2].erase(a.second);
}
return false;
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
time_t Stop = clock() + 3.4 * CLOCKS_PER_SEC;
N = (int) x.size();
if (N == 1) {
build({}, {}, {}, {});
return 1;
}
int maxx = x[0];
int minx = x[0];
int maxy = y[0];
int miny = y[0];
for (int i = 0; i < N; ++i) {
maxx = std::max(maxx, x[i]);
minx = std::min(minx, x[i]);
maxy = std::max(maxy, y[i]);
miny = std::min(miny, y[i]);
}
for (int i = 0; i < N; ++i) {
map[x[i] / 2][y[i]] = i;
}
while (true) {
std::vector<int> u, v, a, b;
bool seen[N];
for (int i = 0; i < N; ++i) {
seen[i] = false;
}
std::queue<int> bfs;
int start = 0;
if (shuffle) {
for (int i = 0; i < N; ++i) {
if (x[i] < x[start]) start = i;
if (x[i] == x[start] && y[i] < y[start]) start = i;
}
}
if (Shuffle) {
start = Rand() % N;
}
bfs.push(start);
seen[start] = true;
auto add = [&](int x, int y, std::vector<int> &data) {
if (x < 0 || x > 200000) return;
if (map[x / 2].count(y)) data.push_back(map[x / 2][y]);
};
auto edges = [&](int x, int y) {
std::vector<int> result;
add(x, y + 2, result);
add(x, y - 2, result);
add(x + 2, y, result);
add(x - 2, y, result);
if (Shuffle) {
std::shuffle(result.begin(), result.end(), Rand);
}
return result;
};
int rem = N - 1;
while (!bfs.empty()) {
auto next = bfs.front();
bfs.pop();
for (auto n: edges(x[next], y[next])) {
if (!seen[n]) {
seen[n] = true;
bfs.push(n);
rem--;
u.push_back(next);
v.push_back(n);
}
}
}
if (rem)
return 0;
std::function<std::vector<std::pair<int, int>>(int, int)> valid = [&x, &y, minx, maxx, miny, maxy](int u,
int v) -> std::vector<std::pair<int, int>> {
if (x[u] == x[v]) {
int _y = (y[u] + y[v]) / 2;
if (x[u] == minx) return {{minx - 1, _y}};
if (x[u] == maxx) return {{maxx + 1, _y}};
return {{x[u] + 1, _y},
{x[u] - 1, _y}};
} else {
int _x = (x[u] + x[v]) / 2;
if (y[u] == miny) return {{_x, miny - 1}};
if (y[u] == maxy) return {{_x, maxy + 1}};
return {{_x, y[u] + 1},
{_x, y[u] - 1}};
}
};
if (shuffle) {
std::vector<std::pair<int, int>> Edges;
for (int i = 0; i < N - 1; ++i) {
Edges.emplace_back(u[i], v[i]);
}
auto pos = [&](int a) {
return std::make_pair(x[a], y[a]);
};
std::sort(Edges.begin(), Edges.end(), [&](std::pair<int, int> a, std::pair<int, int> b) {
auto A = std::min(pos(a.first), pos(a.second));
auto B = std::min(pos(b.first), pos(b.second));
return A < B;
});
for (int i = 0; i < N - 1; ++i) {
u[i] = Edges[i].first;
v[i] = Edges[i].second;
}
}
for (int i = 0; i < N - 1; ++i) {
vld[i] = valid(u[i], v[i]);
if (Shuffle && vld[i].size() == 2 && Rand() % 2) {
std::swap(vld[i][0], vld[i][1]);
}
}
for (int i = 0; i < N - 1; ++i) {
for (auto n: vld[i]) {
rely[n.first / 2][n.second].push_back(i);
}
}
if (shuffle && !Shuffle)
stop = clock() + 2 * CLOCKS_PER_SEC;
else stop = Stop;
if (backtrack(0)) {
#ifdef LOCAL
printf("Called backtrack %ld times.\n", called);
called = 0;
#endif
for (int i = 0; i < N - 1; ++i) {
a.push_back(assigned[i].first);
b.push_back(assigned[i].second);
}
build(u, v, a, b);
return 1;
}
#ifdef LOCAL
printf("Called backtrack %ld times.\n", called);
called = 0;
#endif
for (auto _x: x) {
rely[(_x - 1) / 2].clear();
rely[(_x + 1) / 2].clear();
}
if (shuffle && !Shuffle) {
shuffle = false;
} else if (!(shuffle || Shuffle)) {
Shuffle = true;
} else {
shuffle = true;
}
#ifdef LOCAL
printf("Retrying...\n");
#endif
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23132 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
7 ms |
23128 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23128 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
171 ms |
66728 KB |
Output is correct |
10 |
Correct |
22 ms |
27204 KB |
Output is correct |
11 |
Correct |
88 ms |
46044 KB |
Output is correct |
12 |
Correct |
29 ms |
29352 KB |
Output is correct |
13 |
Correct |
21 ms |
26216 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23132 KB |
Output is correct |
16 |
Correct |
172 ms |
66552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23132 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
7 ms |
23128 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23128 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
171 ms |
66728 KB |
Output is correct |
10 |
Correct |
22 ms |
27204 KB |
Output is correct |
11 |
Correct |
88 ms |
46044 KB |
Output is correct |
12 |
Correct |
29 ms |
29352 KB |
Output is correct |
13 |
Correct |
21 ms |
26216 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23132 KB |
Output is correct |
16 |
Correct |
172 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
22952 KB |
Output is correct |
18 |
Correct |
7 ms |
23128 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
8 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
23128 KB |
Output is correct |
22 |
Correct |
7 ms |
23128 KB |
Output is correct |
23 |
Correct |
409 ms |
108676 KB |
Output is correct |
24 |
Correct |
7 ms |
23128 KB |
Output is correct |
25 |
Correct |
9 ms |
23644 KB |
Output is correct |
26 |
Correct |
8 ms |
23128 KB |
Output is correct |
27 |
Correct |
8 ms |
23324 KB |
Output is correct |
28 |
Correct |
146 ms |
55700 KB |
Output is correct |
29 |
Correct |
221 ms |
73828 KB |
Output is correct |
30 |
Correct |
297 ms |
88408 KB |
Output is correct |
31 |
Correct |
376 ms |
108540 KB |
Output is correct |
32 |
Correct |
7 ms |
23128 KB |
Output is correct |
33 |
Correct |
7 ms |
23288 KB |
Output is correct |
34 |
Correct |
8 ms |
23132 KB |
Output is correct |
35 |
Correct |
7 ms |
23132 KB |
Output is correct |
36 |
Correct |
7 ms |
23132 KB |
Output is correct |
37 |
Correct |
7 ms |
23132 KB |
Output is correct |
38 |
Correct |
7 ms |
23132 KB |
Output is correct |
39 |
Correct |
7 ms |
23132 KB |
Output is correct |
40 |
Correct |
7 ms |
23132 KB |
Output is correct |
41 |
Correct |
7 ms |
23132 KB |
Output is correct |
42 |
Correct |
7 ms |
23132 KB |
Output is correct |
43 |
Correct |
8 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23128 KB |
Output is correct |
45 |
Correct |
198 ms |
68296 KB |
Output is correct |
46 |
Correct |
317 ms |
88576 KB |
Output is correct |
47 |
Correct |
305 ms |
88860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23132 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
7 ms |
23128 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23128 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
171 ms |
66728 KB |
Output is correct |
10 |
Correct |
22 ms |
27204 KB |
Output is correct |
11 |
Correct |
88 ms |
46044 KB |
Output is correct |
12 |
Correct |
29 ms |
29352 KB |
Output is correct |
13 |
Correct |
21 ms |
26216 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23132 KB |
Output is correct |
16 |
Correct |
172 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
22952 KB |
Output is correct |
18 |
Correct |
7 ms |
23128 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
8 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
23128 KB |
Output is correct |
22 |
Correct |
7 ms |
23128 KB |
Output is correct |
23 |
Correct |
409 ms |
108676 KB |
Output is correct |
24 |
Correct |
7 ms |
23128 KB |
Output is correct |
25 |
Correct |
9 ms |
23644 KB |
Output is correct |
26 |
Correct |
8 ms |
23128 KB |
Output is correct |
27 |
Correct |
8 ms |
23324 KB |
Output is correct |
28 |
Correct |
146 ms |
55700 KB |
Output is correct |
29 |
Correct |
221 ms |
73828 KB |
Output is correct |
30 |
Correct |
297 ms |
88408 KB |
Output is correct |
31 |
Correct |
376 ms |
108540 KB |
Output is correct |
32 |
Correct |
7 ms |
23128 KB |
Output is correct |
33 |
Correct |
7 ms |
23288 KB |
Output is correct |
34 |
Correct |
8 ms |
23132 KB |
Output is correct |
35 |
Correct |
7 ms |
23132 KB |
Output is correct |
36 |
Correct |
7 ms |
23132 KB |
Output is correct |
37 |
Correct |
7 ms |
23132 KB |
Output is correct |
38 |
Correct |
7 ms |
23132 KB |
Output is correct |
39 |
Correct |
7 ms |
23132 KB |
Output is correct |
40 |
Correct |
7 ms |
23132 KB |
Output is correct |
41 |
Correct |
7 ms |
23132 KB |
Output is correct |
42 |
Correct |
7 ms |
23132 KB |
Output is correct |
43 |
Correct |
8 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23128 KB |
Output is correct |
45 |
Correct |
198 ms |
68296 KB |
Output is correct |
46 |
Correct |
317 ms |
88576 KB |
Output is correct |
47 |
Correct |
305 ms |
88860 KB |
Output is correct |
48 |
Correct |
6 ms |
23132 KB |
Output is correct |
49 |
Correct |
7 ms |
22960 KB |
Output is correct |
50 |
Correct |
7 ms |
23132 KB |
Output is correct |
51 |
Correct |
7 ms |
23132 KB |
Output is correct |
52 |
Correct |
7 ms |
23128 KB |
Output is correct |
53 |
Correct |
7 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23128 KB |
Output is correct |
55 |
Correct |
406 ms |
106548 KB |
Output is correct |
56 |
Correct |
7 ms |
23132 KB |
Output is correct |
57 |
Correct |
76 ms |
23784 KB |
Output is correct |
58 |
Correct |
19 ms |
25944 KB |
Output is correct |
59 |
Correct |
12 ms |
23644 KB |
Output is correct |
60 |
Correct |
3040 ms |
66228 KB |
Output is correct |
61 |
Correct |
264 ms |
81296 KB |
Output is correct |
62 |
Correct |
319 ms |
92336 KB |
Output is correct |
63 |
Correct |
420 ms |
106136 KB |
Output is correct |
64 |
Correct |
7 ms |
23132 KB |
Output is correct |
65 |
Correct |
7 ms |
23132 KB |
Output is correct |
66 |
Correct |
7 ms |
23132 KB |
Output is correct |
67 |
Correct |
373 ms |
108796 KB |
Output is correct |
68 |
Correct |
390 ms |
108796 KB |
Output is correct |
69 |
Correct |
409 ms |
108240 KB |
Output is correct |
70 |
Correct |
9 ms |
23388 KB |
Output is correct |
71 |
Correct |
9 ms |
23644 KB |
Output is correct |
72 |
Correct |
215 ms |
66716 KB |
Output is correct |
73 |
Correct |
334 ms |
89160 KB |
Output is correct |
74 |
Correct |
463 ms |
111040 KB |
Output is correct |
75 |
Correct |
395 ms |
112104 KB |
Output is correct |
76 |
Correct |
364 ms |
108844 KB |
Output is correct |
77 |
Correct |
8 ms |
23384 KB |
Output is correct |
78 |
Correct |
9 ms |
23644 KB |
Output is correct |
79 |
Correct |
213 ms |
66672 KB |
Output is correct |
80 |
Correct |
326 ms |
88388 KB |
Output is correct |
81 |
Correct |
454 ms |
110232 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23132 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
7 ms |
23128 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23128 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
171 ms |
66728 KB |
Output is correct |
10 |
Correct |
22 ms |
27204 KB |
Output is correct |
11 |
Correct |
88 ms |
46044 KB |
Output is correct |
12 |
Correct |
29 ms |
29352 KB |
Output is correct |
13 |
Correct |
21 ms |
26216 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23132 KB |
Output is correct |
16 |
Correct |
172 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
23132 KB |
Output is correct |
18 |
Correct |
7 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
451 ms |
133920 KB |
Output is correct |
21 |
Correct |
402 ms |
117148 KB |
Output is correct |
22 |
Correct |
574 ms |
117272 KB |
Output is correct |
23 |
Correct |
407 ms |
109628 KB |
Output is correct |
24 |
Correct |
59 ms |
34440 KB |
Output is correct |
25 |
Correct |
64 ms |
34384 KB |
Output is correct |
26 |
Correct |
60 ms |
34384 KB |
Output is correct |
27 |
Correct |
432 ms |
122388 KB |
Output is correct |
28 |
Correct |
474 ms |
122552 KB |
Output is correct |
29 |
Correct |
463 ms |
124180 KB |
Output is correct |
30 |
Correct |
457 ms |
124160 KB |
Output is correct |
31 |
Correct |
7 ms |
23128 KB |
Output is correct |
32 |
Correct |
2044 ms |
29520 KB |
Output is correct |
33 |
Correct |
47 ms |
38748 KB |
Output is correct |
34 |
Correct |
475 ms |
134212 KB |
Output is correct |
35 |
Correct |
10 ms |
23644 KB |
Output is correct |
36 |
Correct |
22 ms |
26116 KB |
Output is correct |
37 |
Correct |
39 ms |
29148 KB |
Output is correct |
38 |
Correct |
2256 ms |
58864 KB |
Output is correct |
39 |
Correct |
2357 ms |
72684 KB |
Output is correct |
40 |
Correct |
2478 ms |
86324 KB |
Output is correct |
41 |
Correct |
2636 ms |
99856 KB |
Output is correct |
42 |
Correct |
2700 ms |
113140 KB |
Output is correct |
43 |
Correct |
7 ms |
23132 KB |
Output is correct |
44 |
Correct |
7 ms |
22960 KB |
Output is correct |
45 |
Correct |
7 ms |
23132 KB |
Output is correct |
46 |
Correct |
7 ms |
23132 KB |
Output is correct |
47 |
Correct |
7 ms |
23132 KB |
Output is correct |
48 |
Correct |
8 ms |
23132 KB |
Output is correct |
49 |
Correct |
7 ms |
22952 KB |
Output is correct |
50 |
Correct |
7 ms |
23128 KB |
Output is correct |
51 |
Correct |
7 ms |
23132 KB |
Output is correct |
52 |
Correct |
8 ms |
23128 KB |
Output is correct |
53 |
Correct |
7 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23132 KB |
Output is correct |
55 |
Correct |
7 ms |
23132 KB |
Output is correct |
56 |
Correct |
196 ms |
68164 KB |
Output is correct |
57 |
Correct |
306 ms |
88764 KB |
Output is correct |
58 |
Correct |
299 ms |
88576 KB |
Output is correct |
59 |
Correct |
7 ms |
23128 KB |
Output is correct |
60 |
Correct |
7 ms |
23132 KB |
Output is correct |
61 |
Correct |
7 ms |
23132 KB |
Output is correct |
62 |
Correct |
353 ms |
108668 KB |
Output is correct |
63 |
Correct |
376 ms |
108832 KB |
Output is correct |
64 |
Correct |
380 ms |
108504 KB |
Output is correct |
65 |
Correct |
8 ms |
23388 KB |
Output is correct |
66 |
Correct |
10 ms |
23452 KB |
Output is correct |
67 |
Correct |
219 ms |
66928 KB |
Output is correct |
68 |
Correct |
342 ms |
88928 KB |
Output is correct |
69 |
Correct |
473 ms |
110904 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23132 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
7 ms |
23128 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23128 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
171 ms |
66728 KB |
Output is correct |
10 |
Correct |
22 ms |
27204 KB |
Output is correct |
11 |
Correct |
88 ms |
46044 KB |
Output is correct |
12 |
Correct |
29 ms |
29352 KB |
Output is correct |
13 |
Correct |
21 ms |
26216 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23132 KB |
Output is correct |
16 |
Correct |
172 ms |
66552 KB |
Output is correct |
17 |
Correct |
479 ms |
121388 KB |
Output is correct |
18 |
Correct |
440 ms |
129576 KB |
Output is correct |
19 |
Correct |
411 ms |
117204 KB |
Output is correct |
20 |
Correct |
446 ms |
108972 KB |
Output is correct |
21 |
Correct |
421 ms |
110508 KB |
Output is correct |
22 |
Correct |
7 ms |
23128 KB |
Output is correct |
23 |
Correct |
2094 ms |
37420 KB |
Output is correct |
24 |
Correct |
13 ms |
24412 KB |
Output is correct |
25 |
Correct |
27 ms |
27220 KB |
Output is correct |
26 |
Correct |
42 ms |
30384 KB |
Output is correct |
27 |
Correct |
2321 ms |
69276 KB |
Output is correct |
28 |
Correct |
2407 ms |
80596 KB |
Output is correct |
29 |
Correct |
2533 ms |
91516 KB |
Output is correct |
30 |
Correct |
2592 ms |
103112 KB |
Output is correct |
31 |
Correct |
2655 ms |
114496 KB |
Output is correct |
32 |
Correct |
389 ms |
111976 KB |
Output is correct |
33 |
Correct |
370 ms |
108784 KB |
Output is correct |
34 |
Correct |
8 ms |
23388 KB |
Output is correct |
35 |
Correct |
9 ms |
23644 KB |
Output is correct |
36 |
Correct |
222 ms |
66660 KB |
Output is correct |
37 |
Correct |
318 ms |
88296 KB |
Output is correct |
38 |
Correct |
471 ms |
110380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23132 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
7 ms |
23128 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23128 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
171 ms |
66728 KB |
Output is correct |
10 |
Correct |
22 ms |
27204 KB |
Output is correct |
11 |
Correct |
88 ms |
46044 KB |
Output is correct |
12 |
Correct |
29 ms |
29352 KB |
Output is correct |
13 |
Correct |
21 ms |
26216 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23132 KB |
Output is correct |
16 |
Correct |
172 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
22952 KB |
Output is correct |
18 |
Correct |
7 ms |
23128 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
8 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
23128 KB |
Output is correct |
22 |
Correct |
7 ms |
23128 KB |
Output is correct |
23 |
Correct |
409 ms |
108676 KB |
Output is correct |
24 |
Correct |
7 ms |
23128 KB |
Output is correct |
25 |
Correct |
9 ms |
23644 KB |
Output is correct |
26 |
Correct |
8 ms |
23128 KB |
Output is correct |
27 |
Correct |
8 ms |
23324 KB |
Output is correct |
28 |
Correct |
146 ms |
55700 KB |
Output is correct |
29 |
Correct |
221 ms |
73828 KB |
Output is correct |
30 |
Correct |
297 ms |
88408 KB |
Output is correct |
31 |
Correct |
376 ms |
108540 KB |
Output is correct |
32 |
Correct |
7 ms |
23128 KB |
Output is correct |
33 |
Correct |
7 ms |
23288 KB |
Output is correct |
34 |
Correct |
8 ms |
23132 KB |
Output is correct |
35 |
Correct |
7 ms |
23132 KB |
Output is correct |
36 |
Correct |
7 ms |
23132 KB |
Output is correct |
37 |
Correct |
7 ms |
23132 KB |
Output is correct |
38 |
Correct |
7 ms |
23132 KB |
Output is correct |
39 |
Correct |
7 ms |
23132 KB |
Output is correct |
40 |
Correct |
7 ms |
23132 KB |
Output is correct |
41 |
Correct |
7 ms |
23132 KB |
Output is correct |
42 |
Correct |
7 ms |
23132 KB |
Output is correct |
43 |
Correct |
8 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23128 KB |
Output is correct |
45 |
Correct |
198 ms |
68296 KB |
Output is correct |
46 |
Correct |
317 ms |
88576 KB |
Output is correct |
47 |
Correct |
305 ms |
88860 KB |
Output is correct |
48 |
Correct |
6 ms |
23132 KB |
Output is correct |
49 |
Correct |
7 ms |
22960 KB |
Output is correct |
50 |
Correct |
7 ms |
23132 KB |
Output is correct |
51 |
Correct |
7 ms |
23132 KB |
Output is correct |
52 |
Correct |
7 ms |
23128 KB |
Output is correct |
53 |
Correct |
7 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23128 KB |
Output is correct |
55 |
Correct |
406 ms |
106548 KB |
Output is correct |
56 |
Correct |
7 ms |
23132 KB |
Output is correct |
57 |
Correct |
76 ms |
23784 KB |
Output is correct |
58 |
Correct |
19 ms |
25944 KB |
Output is correct |
59 |
Correct |
12 ms |
23644 KB |
Output is correct |
60 |
Correct |
3040 ms |
66228 KB |
Output is correct |
61 |
Correct |
264 ms |
81296 KB |
Output is correct |
62 |
Correct |
319 ms |
92336 KB |
Output is correct |
63 |
Correct |
420 ms |
106136 KB |
Output is correct |
64 |
Correct |
7 ms |
23132 KB |
Output is correct |
65 |
Correct |
7 ms |
23132 KB |
Output is correct |
66 |
Correct |
7 ms |
23132 KB |
Output is correct |
67 |
Correct |
373 ms |
108796 KB |
Output is correct |
68 |
Correct |
390 ms |
108796 KB |
Output is correct |
69 |
Correct |
409 ms |
108240 KB |
Output is correct |
70 |
Correct |
9 ms |
23388 KB |
Output is correct |
71 |
Correct |
9 ms |
23644 KB |
Output is correct |
72 |
Correct |
215 ms |
66716 KB |
Output is correct |
73 |
Correct |
334 ms |
89160 KB |
Output is correct |
74 |
Correct |
463 ms |
111040 KB |
Output is correct |
75 |
Correct |
395 ms |
112104 KB |
Output is correct |
76 |
Correct |
364 ms |
108844 KB |
Output is correct |
77 |
Correct |
8 ms |
23384 KB |
Output is correct |
78 |
Correct |
9 ms |
23644 KB |
Output is correct |
79 |
Correct |
213 ms |
66672 KB |
Output is correct |
80 |
Correct |
326 ms |
88388 KB |
Output is correct |
81 |
Correct |
454 ms |
110232 KB |
Output is correct |
82 |
Correct |
7 ms |
23132 KB |
Output is correct |
83 |
Correct |
7 ms |
23132 KB |
Output is correct |
84 |
Correct |
7 ms |
23132 KB |
Output is correct |
85 |
Correct |
451 ms |
133920 KB |
Output is correct |
86 |
Correct |
402 ms |
117148 KB |
Output is correct |
87 |
Correct |
574 ms |
117272 KB |
Output is correct |
88 |
Correct |
407 ms |
109628 KB |
Output is correct |
89 |
Correct |
59 ms |
34440 KB |
Output is correct |
90 |
Correct |
64 ms |
34384 KB |
Output is correct |
91 |
Correct |
60 ms |
34384 KB |
Output is correct |
92 |
Correct |
432 ms |
122388 KB |
Output is correct |
93 |
Correct |
474 ms |
122552 KB |
Output is correct |
94 |
Correct |
463 ms |
124180 KB |
Output is correct |
95 |
Correct |
457 ms |
124160 KB |
Output is correct |
96 |
Correct |
7 ms |
23128 KB |
Output is correct |
97 |
Correct |
2044 ms |
29520 KB |
Output is correct |
98 |
Correct |
47 ms |
38748 KB |
Output is correct |
99 |
Correct |
475 ms |
134212 KB |
Output is correct |
100 |
Correct |
10 ms |
23644 KB |
Output is correct |
101 |
Correct |
22 ms |
26116 KB |
Output is correct |
102 |
Correct |
39 ms |
29148 KB |
Output is correct |
103 |
Correct |
2256 ms |
58864 KB |
Output is correct |
104 |
Correct |
2357 ms |
72684 KB |
Output is correct |
105 |
Correct |
2478 ms |
86324 KB |
Output is correct |
106 |
Correct |
2636 ms |
99856 KB |
Output is correct |
107 |
Correct |
2700 ms |
113140 KB |
Output is correct |
108 |
Correct |
7 ms |
23132 KB |
Output is correct |
109 |
Correct |
7 ms |
22960 KB |
Output is correct |
110 |
Correct |
7 ms |
23132 KB |
Output is correct |
111 |
Correct |
7 ms |
23132 KB |
Output is correct |
112 |
Correct |
7 ms |
23132 KB |
Output is correct |
113 |
Correct |
8 ms |
23132 KB |
Output is correct |
114 |
Correct |
7 ms |
22952 KB |
Output is correct |
115 |
Correct |
7 ms |
23128 KB |
Output is correct |
116 |
Correct |
7 ms |
23132 KB |
Output is correct |
117 |
Correct |
8 ms |
23128 KB |
Output is correct |
118 |
Correct |
7 ms |
23132 KB |
Output is correct |
119 |
Correct |
7 ms |
23132 KB |
Output is correct |
120 |
Correct |
7 ms |
23132 KB |
Output is correct |
121 |
Correct |
196 ms |
68164 KB |
Output is correct |
122 |
Correct |
306 ms |
88764 KB |
Output is correct |
123 |
Correct |
299 ms |
88576 KB |
Output is correct |
124 |
Correct |
7 ms |
23128 KB |
Output is correct |
125 |
Correct |
7 ms |
23132 KB |
Output is correct |
126 |
Correct |
7 ms |
23132 KB |
Output is correct |
127 |
Correct |
353 ms |
108668 KB |
Output is correct |
128 |
Correct |
376 ms |
108832 KB |
Output is correct |
129 |
Correct |
380 ms |
108504 KB |
Output is correct |
130 |
Correct |
8 ms |
23388 KB |
Output is correct |
131 |
Correct |
10 ms |
23452 KB |
Output is correct |
132 |
Correct |
219 ms |
66928 KB |
Output is correct |
133 |
Correct |
342 ms |
88928 KB |
Output is correct |
134 |
Correct |
473 ms |
110904 KB |
Output is correct |
135 |
Correct |
479 ms |
121388 KB |
Output is correct |
136 |
Correct |
440 ms |
129576 KB |
Output is correct |
137 |
Correct |
411 ms |
117204 KB |
Output is correct |
138 |
Correct |
446 ms |
108972 KB |
Output is correct |
139 |
Correct |
421 ms |
110508 KB |
Output is correct |
140 |
Correct |
7 ms |
23128 KB |
Output is correct |
141 |
Correct |
2094 ms |
37420 KB |
Output is correct |
142 |
Correct |
13 ms |
24412 KB |
Output is correct |
143 |
Correct |
27 ms |
27220 KB |
Output is correct |
144 |
Correct |
42 ms |
30384 KB |
Output is correct |
145 |
Correct |
2321 ms |
69276 KB |
Output is correct |
146 |
Correct |
2407 ms |
80596 KB |
Output is correct |
147 |
Correct |
2533 ms |
91516 KB |
Output is correct |
148 |
Correct |
2592 ms |
103112 KB |
Output is correct |
149 |
Correct |
2655 ms |
114496 KB |
Output is correct |
150 |
Correct |
389 ms |
111976 KB |
Output is correct |
151 |
Correct |
370 ms |
108784 KB |
Output is correct |
152 |
Correct |
8 ms |
23388 KB |
Output is correct |
153 |
Correct |
9 ms |
23644 KB |
Output is correct |
154 |
Correct |
222 ms |
66660 KB |
Output is correct |
155 |
Correct |
318 ms |
88296 KB |
Output is correct |
156 |
Correct |
471 ms |
110380 KB |
Output is correct |
157 |
Correct |
7 ms |
23132 KB |
Output is correct |
158 |
Correct |
7 ms |
23132 KB |
Output is correct |
159 |
Correct |
7 ms |
23132 KB |
Output is correct |
160 |
Correct |
7 ms |
23132 KB |
Output is correct |
161 |
Correct |
445 ms |
105688 KB |
Output is correct |
162 |
Correct |
470 ms |
134024 KB |
Output is correct |
163 |
Correct |
443 ms |
122848 KB |
Output is correct |
164 |
Correct |
444 ms |
122764 KB |
Output is correct |
165 |
Correct |
581 ms |
108244 KB |
Output is correct |
166 |
Correct |
1505 ms |
109456 KB |
Output is correct |
167 |
Execution timed out |
3551 ms |
33152 KB |
Time limit exceeded |
168 |
Halted |
0 ms |
0 KB |
- |