#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]);
}
std::sort(Edges.begin(), Edges.end(), [&](std::pair<int, int> a, std::pair<int, int> b) {
int A = a.first;
int B = b.first;
if (x[A] == x[B]) return y[A] < y[B];
return x[A] < x[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() + 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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
23128 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
6 ms |
23112 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
144 ms |
66736 KB |
Output is correct |
10 |
Correct |
20 ms |
27276 KB |
Output is correct |
11 |
Correct |
78 ms |
46208 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 ms |
26220 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23216 KB |
Output is correct |
16 |
Correct |
140 ms |
66724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
23128 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
6 ms |
23112 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
144 ms |
66736 KB |
Output is correct |
10 |
Correct |
20 ms |
27276 KB |
Output is correct |
11 |
Correct |
78 ms |
46208 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 ms |
26220 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23216 KB |
Output is correct |
16 |
Correct |
140 ms |
66724 KB |
Output is correct |
17 |
Correct |
6 ms |
23132 KB |
Output is correct |
18 |
Correct |
6 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23128 KB |
Output is correct |
20 |
Correct |
7 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
23128 KB |
Output is correct |
22 |
Correct |
8 ms |
23132 KB |
Output is correct |
23 |
Correct |
316 ms |
108528 KB |
Output is correct |
24 |
Correct |
6 ms |
23132 KB |
Output is correct |
25 |
Correct |
9 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23384 KB |
Output is correct |
27 |
Correct |
8 ms |
23212 KB |
Output is correct |
28 |
Correct |
124 ms |
55680 KB |
Output is correct |
29 |
Correct |
184 ms |
73868 KB |
Output is correct |
30 |
Correct |
240 ms |
88308 KB |
Output is correct |
31 |
Correct |
314 ms |
108796 KB |
Output is correct |
32 |
Correct |
7 ms |
23132 KB |
Output is correct |
33 |
Correct |
7 ms |
23132 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 |
8 ms |
23132 KB |
Output is correct |
38 |
Correct |
7 ms |
22996 KB |
Output is correct |
39 |
Correct |
7 ms |
23132 KB |
Output is correct |
40 |
Correct |
8 ms |
23128 KB |
Output is correct |
41 |
Correct |
7 ms |
23132 KB |
Output is correct |
42 |
Correct |
6 ms |
23132 KB |
Output is correct |
43 |
Correct |
7 ms |
23128 KB |
Output is correct |
44 |
Correct |
7 ms |
23260 KB |
Output is correct |
45 |
Correct |
166 ms |
68296 KB |
Output is correct |
46 |
Correct |
264 ms |
88888 KB |
Output is correct |
47 |
Correct |
256 ms |
88724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
23128 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
6 ms |
23112 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
144 ms |
66736 KB |
Output is correct |
10 |
Correct |
20 ms |
27276 KB |
Output is correct |
11 |
Correct |
78 ms |
46208 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 ms |
26220 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23216 KB |
Output is correct |
16 |
Correct |
140 ms |
66724 KB |
Output is correct |
17 |
Correct |
6 ms |
23132 KB |
Output is correct |
18 |
Correct |
6 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23128 KB |
Output is correct |
20 |
Correct |
7 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
23128 KB |
Output is correct |
22 |
Correct |
8 ms |
23132 KB |
Output is correct |
23 |
Correct |
316 ms |
108528 KB |
Output is correct |
24 |
Correct |
6 ms |
23132 KB |
Output is correct |
25 |
Correct |
9 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23384 KB |
Output is correct |
27 |
Correct |
8 ms |
23212 KB |
Output is correct |
28 |
Correct |
124 ms |
55680 KB |
Output is correct |
29 |
Correct |
184 ms |
73868 KB |
Output is correct |
30 |
Correct |
240 ms |
88308 KB |
Output is correct |
31 |
Correct |
314 ms |
108796 KB |
Output is correct |
32 |
Correct |
7 ms |
23132 KB |
Output is correct |
33 |
Correct |
7 ms |
23132 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 |
8 ms |
23132 KB |
Output is correct |
38 |
Correct |
7 ms |
22996 KB |
Output is correct |
39 |
Correct |
7 ms |
23132 KB |
Output is correct |
40 |
Correct |
8 ms |
23128 KB |
Output is correct |
41 |
Correct |
7 ms |
23132 KB |
Output is correct |
42 |
Correct |
6 ms |
23132 KB |
Output is correct |
43 |
Correct |
7 ms |
23128 KB |
Output is correct |
44 |
Correct |
7 ms |
23260 KB |
Output is correct |
45 |
Correct |
166 ms |
68296 KB |
Output is correct |
46 |
Correct |
264 ms |
88888 KB |
Output is correct |
47 |
Correct |
256 ms |
88724 KB |
Output is correct |
48 |
Correct |
7 ms |
23128 KB |
Output is correct |
49 |
Correct |
6 ms |
23132 KB |
Output is correct |
50 |
Correct |
6 ms |
23132 KB |
Output is correct |
51 |
Correct |
8 ms |
23120 KB |
Output is correct |
52 |
Correct |
7 ms |
23132 KB |
Output is correct |
53 |
Correct |
6 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23128 KB |
Output is correct |
55 |
Correct |
327 ms |
106012 KB |
Output is correct |
56 |
Correct |
7 ms |
23128 KB |
Output is correct |
57 |
Correct |
74 ms |
23892 KB |
Output is correct |
58 |
Correct |
15 ms |
25692 KB |
Output is correct |
59 |
Correct |
9 ms |
23644 KB |
Output is correct |
60 |
Correct |
1946 ms |
66224 KB |
Output is correct |
61 |
Correct |
239 ms |
81300 KB |
Output is correct |
62 |
Correct |
285 ms |
92360 KB |
Output is correct |
63 |
Correct |
317 ms |
106144 KB |
Output is correct |
64 |
Correct |
8 ms |
23128 KB |
Output is correct |
65 |
Correct |
7 ms |
23132 KB |
Output is correct |
66 |
Correct |
6 ms |
23132 KB |
Output is correct |
67 |
Correct |
290 ms |
110492 KB |
Output is correct |
68 |
Correct |
302 ms |
110552 KB |
Output is correct |
69 |
Correct |
333 ms |
110060 KB |
Output is correct |
70 |
Correct |
8 ms |
23388 KB |
Output is correct |
71 |
Correct |
9 ms |
23740 KB |
Output is correct |
72 |
Correct |
175 ms |
67632 KB |
Output is correct |
73 |
Correct |
282 ms |
90180 KB |
Output is correct |
74 |
Correct |
388 ms |
112904 KB |
Output is correct |
75 |
Correct |
316 ms |
113740 KB |
Output is correct |
76 |
Correct |
310 ms |
110488 KB |
Output is correct |
77 |
Correct |
8 ms |
23384 KB |
Output is correct |
78 |
Correct |
9 ms |
23644 KB |
Output is correct |
79 |
Correct |
169 ms |
67384 KB |
Output is correct |
80 |
Correct |
265 ms |
89692 KB |
Output is correct |
81 |
Correct |
375 ms |
112076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
23128 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
6 ms |
23112 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
144 ms |
66736 KB |
Output is correct |
10 |
Correct |
20 ms |
27276 KB |
Output is correct |
11 |
Correct |
78 ms |
46208 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 ms |
26220 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23216 KB |
Output is correct |
16 |
Correct |
140 ms |
66724 KB |
Output is correct |
17 |
Correct |
8 ms |
23132 KB |
Output is correct |
18 |
Correct |
8 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
362 ms |
133840 KB |
Output is correct |
21 |
Correct |
335 ms |
117508 KB |
Output is correct |
22 |
Correct |
407 ms |
117112 KB |
Output is correct |
23 |
Correct |
313 ms |
109548 KB |
Output is correct |
24 |
Correct |
59 ms |
34384 KB |
Output is correct |
25 |
Correct |
69 ms |
34412 KB |
Output is correct |
26 |
Correct |
70 ms |
34384 KB |
Output is correct |
27 |
Correct |
357 ms |
122360 KB |
Output is correct |
28 |
Correct |
364 ms |
122412 KB |
Output is correct |
29 |
Correct |
373 ms |
124232 KB |
Output is correct |
30 |
Correct |
387 ms |
124288 KB |
Output is correct |
31 |
Correct |
7 ms |
23132 KB |
Output is correct |
32 |
Correct |
1038 ms |
29520 KB |
Output is correct |
33 |
Correct |
47 ms |
38740 KB |
Output is correct |
34 |
Correct |
365 ms |
133756 KB |
Output is correct |
35 |
Correct |
10 ms |
23644 KB |
Output is correct |
36 |
Correct |
22 ms |
26088 KB |
Output is correct |
37 |
Correct |
38 ms |
29264 KB |
Output is correct |
38 |
Correct |
1204 ms |
58952 KB |
Output is correct |
39 |
Correct |
1297 ms |
72832 KB |
Output is correct |
40 |
Correct |
1395 ms |
86468 KB |
Output is correct |
41 |
Correct |
1518 ms |
99920 KB |
Output is correct |
42 |
Correct |
1671 ms |
113300 KB |
Output is correct |
43 |
Correct |
7 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23132 KB |
Output is correct |
45 |
Correct |
7 ms |
23128 KB |
Output is correct |
46 |
Correct |
8 ms |
23132 KB |
Output is correct |
47 |
Correct |
9 ms |
23132 KB |
Output is correct |
48 |
Correct |
7 ms |
23132 KB |
Output is correct |
49 |
Correct |
7 ms |
23132 KB |
Output is correct |
50 |
Correct |
8 ms |
23132 KB |
Output is correct |
51 |
Correct |
7 ms |
23128 KB |
Output is correct |
52 |
Correct |
7 ms |
23132 KB |
Output is correct |
53 |
Correct |
7 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23132 KB |
Output is correct |
55 |
Correct |
8 ms |
23132 KB |
Output is correct |
56 |
Correct |
172 ms |
68488 KB |
Output is correct |
57 |
Correct |
251 ms |
88896 KB |
Output is correct |
58 |
Correct |
273 ms |
88748 KB |
Output is correct |
59 |
Correct |
7 ms |
23132 KB |
Output is correct |
60 |
Correct |
8 ms |
23128 KB |
Output is correct |
61 |
Correct |
6 ms |
23128 KB |
Output is correct |
62 |
Correct |
304 ms |
109104 KB |
Output is correct |
63 |
Correct |
306 ms |
108792 KB |
Output is correct |
64 |
Correct |
306 ms |
108340 KB |
Output is correct |
65 |
Correct |
7 ms |
23384 KB |
Output is correct |
66 |
Correct |
10 ms |
23644 KB |
Output is correct |
67 |
Correct |
178 ms |
66744 KB |
Output is correct |
68 |
Correct |
266 ms |
88872 KB |
Output is correct |
69 |
Correct |
368 ms |
111252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
23128 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
6 ms |
23112 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
144 ms |
66736 KB |
Output is correct |
10 |
Correct |
20 ms |
27276 KB |
Output is correct |
11 |
Correct |
78 ms |
46208 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 ms |
26220 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23216 KB |
Output is correct |
16 |
Correct |
140 ms |
66724 KB |
Output is correct |
17 |
Correct |
379 ms |
121440 KB |
Output is correct |
18 |
Correct |
359 ms |
129500 KB |
Output is correct |
19 |
Correct |
336 ms |
117240 KB |
Output is correct |
20 |
Correct |
360 ms |
108948 KB |
Output is correct |
21 |
Correct |
346 ms |
110524 KB |
Output is correct |
22 |
Correct |
6 ms |
23132 KB |
Output is correct |
23 |
Correct |
1080 ms |
37408 KB |
Output is correct |
24 |
Correct |
13 ms |
24408 KB |
Output is correct |
25 |
Correct |
28 ms |
27284 KB |
Output is correct |
26 |
Correct |
42 ms |
30300 KB |
Output is correct |
27 |
Correct |
1263 ms |
69292 KB |
Output is correct |
28 |
Correct |
1340 ms |
80848 KB |
Output is correct |
29 |
Correct |
1432 ms |
92328 KB |
Output is correct |
30 |
Correct |
1483 ms |
103204 KB |
Output is correct |
31 |
Correct |
1573 ms |
114220 KB |
Output is correct |
32 |
Correct |
312 ms |
112096 KB |
Output is correct |
33 |
Correct |
305 ms |
108844 KB |
Output is correct |
34 |
Correct |
8 ms |
23384 KB |
Output is correct |
35 |
Correct |
9 ms |
23644 KB |
Output is correct |
36 |
Correct |
172 ms |
66532 KB |
Output is correct |
37 |
Correct |
269 ms |
88384 KB |
Output is correct |
38 |
Correct |
358 ms |
110364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
23128 KB |
Output is correct |
2 |
Correct |
7 ms |
23132 KB |
Output is correct |
3 |
Correct |
7 ms |
23132 KB |
Output is correct |
4 |
Correct |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
6 ms |
23112 KB |
Output is correct |
6 |
Correct |
7 ms |
23132 KB |
Output is correct |
7 |
Correct |
7 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
144 ms |
66736 KB |
Output is correct |
10 |
Correct |
20 ms |
27276 KB |
Output is correct |
11 |
Correct |
78 ms |
46208 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 ms |
26220 KB |
Output is correct |
14 |
Correct |
7 ms |
23132 KB |
Output is correct |
15 |
Correct |
7 ms |
23216 KB |
Output is correct |
16 |
Correct |
140 ms |
66724 KB |
Output is correct |
17 |
Correct |
6 ms |
23132 KB |
Output is correct |
18 |
Correct |
6 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23128 KB |
Output is correct |
20 |
Correct |
7 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
23128 KB |
Output is correct |
22 |
Correct |
8 ms |
23132 KB |
Output is correct |
23 |
Correct |
316 ms |
108528 KB |
Output is correct |
24 |
Correct |
6 ms |
23132 KB |
Output is correct |
25 |
Correct |
9 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23384 KB |
Output is correct |
27 |
Correct |
8 ms |
23212 KB |
Output is correct |
28 |
Correct |
124 ms |
55680 KB |
Output is correct |
29 |
Correct |
184 ms |
73868 KB |
Output is correct |
30 |
Correct |
240 ms |
88308 KB |
Output is correct |
31 |
Correct |
314 ms |
108796 KB |
Output is correct |
32 |
Correct |
7 ms |
23132 KB |
Output is correct |
33 |
Correct |
7 ms |
23132 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 |
8 ms |
23132 KB |
Output is correct |
38 |
Correct |
7 ms |
22996 KB |
Output is correct |
39 |
Correct |
7 ms |
23132 KB |
Output is correct |
40 |
Correct |
8 ms |
23128 KB |
Output is correct |
41 |
Correct |
7 ms |
23132 KB |
Output is correct |
42 |
Correct |
6 ms |
23132 KB |
Output is correct |
43 |
Correct |
7 ms |
23128 KB |
Output is correct |
44 |
Correct |
7 ms |
23260 KB |
Output is correct |
45 |
Correct |
166 ms |
68296 KB |
Output is correct |
46 |
Correct |
264 ms |
88888 KB |
Output is correct |
47 |
Correct |
256 ms |
88724 KB |
Output is correct |
48 |
Correct |
7 ms |
23128 KB |
Output is correct |
49 |
Correct |
6 ms |
23132 KB |
Output is correct |
50 |
Correct |
6 ms |
23132 KB |
Output is correct |
51 |
Correct |
8 ms |
23120 KB |
Output is correct |
52 |
Correct |
7 ms |
23132 KB |
Output is correct |
53 |
Correct |
6 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23128 KB |
Output is correct |
55 |
Correct |
327 ms |
106012 KB |
Output is correct |
56 |
Correct |
7 ms |
23128 KB |
Output is correct |
57 |
Correct |
74 ms |
23892 KB |
Output is correct |
58 |
Correct |
15 ms |
25692 KB |
Output is correct |
59 |
Correct |
9 ms |
23644 KB |
Output is correct |
60 |
Correct |
1946 ms |
66224 KB |
Output is correct |
61 |
Correct |
239 ms |
81300 KB |
Output is correct |
62 |
Correct |
285 ms |
92360 KB |
Output is correct |
63 |
Correct |
317 ms |
106144 KB |
Output is correct |
64 |
Correct |
8 ms |
23128 KB |
Output is correct |
65 |
Correct |
7 ms |
23132 KB |
Output is correct |
66 |
Correct |
6 ms |
23132 KB |
Output is correct |
67 |
Correct |
290 ms |
110492 KB |
Output is correct |
68 |
Correct |
302 ms |
110552 KB |
Output is correct |
69 |
Correct |
333 ms |
110060 KB |
Output is correct |
70 |
Correct |
8 ms |
23388 KB |
Output is correct |
71 |
Correct |
9 ms |
23740 KB |
Output is correct |
72 |
Correct |
175 ms |
67632 KB |
Output is correct |
73 |
Correct |
282 ms |
90180 KB |
Output is correct |
74 |
Correct |
388 ms |
112904 KB |
Output is correct |
75 |
Correct |
316 ms |
113740 KB |
Output is correct |
76 |
Correct |
310 ms |
110488 KB |
Output is correct |
77 |
Correct |
8 ms |
23384 KB |
Output is correct |
78 |
Correct |
9 ms |
23644 KB |
Output is correct |
79 |
Correct |
169 ms |
67384 KB |
Output is correct |
80 |
Correct |
265 ms |
89692 KB |
Output is correct |
81 |
Correct |
375 ms |
112076 KB |
Output is correct |
82 |
Correct |
8 ms |
23132 KB |
Output is correct |
83 |
Correct |
8 ms |
23132 KB |
Output is correct |
84 |
Correct |
7 ms |
23132 KB |
Output is correct |
85 |
Correct |
362 ms |
133840 KB |
Output is correct |
86 |
Correct |
335 ms |
117508 KB |
Output is correct |
87 |
Correct |
407 ms |
117112 KB |
Output is correct |
88 |
Correct |
313 ms |
109548 KB |
Output is correct |
89 |
Correct |
59 ms |
34384 KB |
Output is correct |
90 |
Correct |
69 ms |
34412 KB |
Output is correct |
91 |
Correct |
70 ms |
34384 KB |
Output is correct |
92 |
Correct |
357 ms |
122360 KB |
Output is correct |
93 |
Correct |
364 ms |
122412 KB |
Output is correct |
94 |
Correct |
373 ms |
124232 KB |
Output is correct |
95 |
Correct |
387 ms |
124288 KB |
Output is correct |
96 |
Correct |
7 ms |
23132 KB |
Output is correct |
97 |
Correct |
1038 ms |
29520 KB |
Output is correct |
98 |
Correct |
47 ms |
38740 KB |
Output is correct |
99 |
Correct |
365 ms |
133756 KB |
Output is correct |
100 |
Correct |
10 ms |
23644 KB |
Output is correct |
101 |
Correct |
22 ms |
26088 KB |
Output is correct |
102 |
Correct |
38 ms |
29264 KB |
Output is correct |
103 |
Correct |
1204 ms |
58952 KB |
Output is correct |
104 |
Correct |
1297 ms |
72832 KB |
Output is correct |
105 |
Correct |
1395 ms |
86468 KB |
Output is correct |
106 |
Correct |
1518 ms |
99920 KB |
Output is correct |
107 |
Correct |
1671 ms |
113300 KB |
Output is correct |
108 |
Correct |
7 ms |
23132 KB |
Output is correct |
109 |
Correct |
8 ms |
23132 KB |
Output is correct |
110 |
Correct |
7 ms |
23128 KB |
Output is correct |
111 |
Correct |
8 ms |
23132 KB |
Output is correct |
112 |
Correct |
9 ms |
23132 KB |
Output is correct |
113 |
Correct |
7 ms |
23132 KB |
Output is correct |
114 |
Correct |
7 ms |
23132 KB |
Output is correct |
115 |
Correct |
8 ms |
23132 KB |
Output is correct |
116 |
Correct |
7 ms |
23128 KB |
Output is correct |
117 |
Correct |
7 ms |
23132 KB |
Output is correct |
118 |
Correct |
7 ms |
23132 KB |
Output is correct |
119 |
Correct |
7 ms |
23132 KB |
Output is correct |
120 |
Correct |
8 ms |
23132 KB |
Output is correct |
121 |
Correct |
172 ms |
68488 KB |
Output is correct |
122 |
Correct |
251 ms |
88896 KB |
Output is correct |
123 |
Correct |
273 ms |
88748 KB |
Output is correct |
124 |
Correct |
7 ms |
23132 KB |
Output is correct |
125 |
Correct |
8 ms |
23128 KB |
Output is correct |
126 |
Correct |
6 ms |
23128 KB |
Output is correct |
127 |
Correct |
304 ms |
109104 KB |
Output is correct |
128 |
Correct |
306 ms |
108792 KB |
Output is correct |
129 |
Correct |
306 ms |
108340 KB |
Output is correct |
130 |
Correct |
7 ms |
23384 KB |
Output is correct |
131 |
Correct |
10 ms |
23644 KB |
Output is correct |
132 |
Correct |
178 ms |
66744 KB |
Output is correct |
133 |
Correct |
266 ms |
88872 KB |
Output is correct |
134 |
Correct |
368 ms |
111252 KB |
Output is correct |
135 |
Correct |
379 ms |
121440 KB |
Output is correct |
136 |
Correct |
359 ms |
129500 KB |
Output is correct |
137 |
Correct |
336 ms |
117240 KB |
Output is correct |
138 |
Correct |
360 ms |
108948 KB |
Output is correct |
139 |
Correct |
346 ms |
110524 KB |
Output is correct |
140 |
Correct |
6 ms |
23132 KB |
Output is correct |
141 |
Correct |
1080 ms |
37408 KB |
Output is correct |
142 |
Correct |
13 ms |
24408 KB |
Output is correct |
143 |
Correct |
28 ms |
27284 KB |
Output is correct |
144 |
Correct |
42 ms |
30300 KB |
Output is correct |
145 |
Correct |
1263 ms |
69292 KB |
Output is correct |
146 |
Correct |
1340 ms |
80848 KB |
Output is correct |
147 |
Correct |
1432 ms |
92328 KB |
Output is correct |
148 |
Correct |
1483 ms |
103204 KB |
Output is correct |
149 |
Correct |
1573 ms |
114220 KB |
Output is correct |
150 |
Correct |
312 ms |
112096 KB |
Output is correct |
151 |
Correct |
305 ms |
108844 KB |
Output is correct |
152 |
Correct |
8 ms |
23384 KB |
Output is correct |
153 |
Correct |
9 ms |
23644 KB |
Output is correct |
154 |
Correct |
172 ms |
66532 KB |
Output is correct |
155 |
Correct |
269 ms |
88384 KB |
Output is correct |
156 |
Correct |
358 ms |
110364 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 |
356 ms |
107472 KB |
Output is correct |
162 |
Correct |
366 ms |
136328 KB |
Output is correct |
163 |
Correct |
357 ms |
125304 KB |
Output is correct |
164 |
Correct |
386 ms |
125248 KB |
Output is correct |
165 |
Correct |
490 ms |
110296 KB |
Output is correct |
166 |
Execution timed out |
3512 ms |
99580 KB |
Time limit exceeded |
167 |
Halted |
0 ms |
0 KB |
- |