#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() + 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 |
7 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 |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
6 ms |
23132 KB |
Output is correct |
7 |
Correct |
6 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
143 ms |
66652 KB |
Output is correct |
10 |
Correct |
19 ms |
27204 KB |
Output is correct |
11 |
Correct |
73 ms |
46188 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 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 |
143 ms |
66552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 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 |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
6 ms |
23132 KB |
Output is correct |
7 |
Correct |
6 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
143 ms |
66652 KB |
Output is correct |
10 |
Correct |
19 ms |
27204 KB |
Output is correct |
11 |
Correct |
73 ms |
46188 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 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 |
143 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
23136 KB |
Output is correct |
18 |
Correct |
7 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
6 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
22964 KB |
Output is correct |
22 |
Correct |
6 ms |
23132 KB |
Output is correct |
23 |
Correct |
318 ms |
108488 KB |
Output is correct |
24 |
Correct |
7 ms |
23132 KB |
Output is correct |
25 |
Correct |
10 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23132 KB |
Output is correct |
27 |
Correct |
8 ms |
23132 KB |
Output is correct |
28 |
Correct |
121 ms |
55632 KB |
Output is correct |
29 |
Correct |
187 ms |
73780 KB |
Output is correct |
30 |
Correct |
245 ms |
88372 KB |
Output is correct |
31 |
Correct |
333 ms |
108488 KB |
Output is correct |
32 |
Correct |
8 ms |
23132 KB |
Output is correct |
33 |
Correct |
6 ms |
23132 KB |
Output is correct |
34 |
Correct |
6 ms |
23132 KB |
Output is correct |
35 |
Correct |
6 ms |
23132 KB |
Output is correct |
36 |
Correct |
6 ms |
22968 KB |
Output is correct |
37 |
Correct |
6 ms |
23132 KB |
Output is correct |
38 |
Correct |
6 ms |
23132 KB |
Output is correct |
39 |
Correct |
6 ms |
23132 KB |
Output is correct |
40 |
Correct |
6 ms |
23132 KB |
Output is correct |
41 |
Correct |
6 ms |
23132 KB |
Output is correct |
42 |
Correct |
7 ms |
22964 KB |
Output is correct |
43 |
Correct |
7 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23132 KB |
Output is correct |
45 |
Correct |
167 ms |
68288 KB |
Output is correct |
46 |
Correct |
253 ms |
88728 KB |
Output is correct |
47 |
Correct |
263 ms |
88856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 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 |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
6 ms |
23132 KB |
Output is correct |
7 |
Correct |
6 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
143 ms |
66652 KB |
Output is correct |
10 |
Correct |
19 ms |
27204 KB |
Output is correct |
11 |
Correct |
73 ms |
46188 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 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 |
143 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
23136 KB |
Output is correct |
18 |
Correct |
7 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
6 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
22964 KB |
Output is correct |
22 |
Correct |
6 ms |
23132 KB |
Output is correct |
23 |
Correct |
318 ms |
108488 KB |
Output is correct |
24 |
Correct |
7 ms |
23132 KB |
Output is correct |
25 |
Correct |
10 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23132 KB |
Output is correct |
27 |
Correct |
8 ms |
23132 KB |
Output is correct |
28 |
Correct |
121 ms |
55632 KB |
Output is correct |
29 |
Correct |
187 ms |
73780 KB |
Output is correct |
30 |
Correct |
245 ms |
88372 KB |
Output is correct |
31 |
Correct |
333 ms |
108488 KB |
Output is correct |
32 |
Correct |
8 ms |
23132 KB |
Output is correct |
33 |
Correct |
6 ms |
23132 KB |
Output is correct |
34 |
Correct |
6 ms |
23132 KB |
Output is correct |
35 |
Correct |
6 ms |
23132 KB |
Output is correct |
36 |
Correct |
6 ms |
22968 KB |
Output is correct |
37 |
Correct |
6 ms |
23132 KB |
Output is correct |
38 |
Correct |
6 ms |
23132 KB |
Output is correct |
39 |
Correct |
6 ms |
23132 KB |
Output is correct |
40 |
Correct |
6 ms |
23132 KB |
Output is correct |
41 |
Correct |
6 ms |
23132 KB |
Output is correct |
42 |
Correct |
7 ms |
22964 KB |
Output is correct |
43 |
Correct |
7 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23132 KB |
Output is correct |
45 |
Correct |
167 ms |
68288 KB |
Output is correct |
46 |
Correct |
253 ms |
88728 KB |
Output is correct |
47 |
Correct |
263 ms |
88856 KB |
Output is correct |
48 |
Correct |
6 ms |
23132 KB |
Output is correct |
49 |
Correct |
6 ms |
23132 KB |
Output is correct |
50 |
Correct |
6 ms |
23132 KB |
Output is correct |
51 |
Correct |
6 ms |
23132 KB |
Output is correct |
52 |
Correct |
6 ms |
23132 KB |
Output is correct |
53 |
Correct |
6 ms |
23132 KB |
Output is correct |
54 |
Correct |
6 ms |
23132 KB |
Output is correct |
55 |
Correct |
312 ms |
106268 KB |
Output is correct |
56 |
Correct |
6 ms |
23132 KB |
Output is correct |
57 |
Correct |
75 ms |
23800 KB |
Output is correct |
58 |
Correct |
14 ms |
25688 KB |
Output is correct |
59 |
Correct |
10 ms |
23644 KB |
Output is correct |
60 |
Correct |
2968 ms |
66228 KB |
Output is correct |
61 |
Correct |
210 ms |
81292 KB |
Output is correct |
62 |
Correct |
263 ms |
92356 KB |
Output is correct |
63 |
Correct |
315 ms |
106132 KB |
Output is correct |
64 |
Correct |
6 ms |
23132 KB |
Output is correct |
65 |
Correct |
6 ms |
23132 KB |
Output is correct |
66 |
Correct |
6 ms |
23132 KB |
Output is correct |
67 |
Correct |
292 ms |
108824 KB |
Output is correct |
68 |
Correct |
302 ms |
108792 KB |
Output is correct |
69 |
Correct |
304 ms |
108560 KB |
Output is correct |
70 |
Correct |
8 ms |
23388 KB |
Output is correct |
71 |
Correct |
9 ms |
23564 KB |
Output is correct |
72 |
Correct |
176 ms |
66728 KB |
Output is correct |
73 |
Correct |
270 ms |
88928 KB |
Output is correct |
74 |
Correct |
377 ms |
111252 KB |
Output is correct |
75 |
Correct |
310 ms |
112096 KB |
Output is correct |
76 |
Correct |
295 ms |
108788 KB |
Output is correct |
77 |
Correct |
8 ms |
23388 KB |
Output is correct |
78 |
Correct |
9 ms |
23644 KB |
Output is correct |
79 |
Correct |
183 ms |
66852 KB |
Output is correct |
80 |
Correct |
262 ms |
88400 KB |
Output is correct |
81 |
Correct |
374 ms |
110480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 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 |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
6 ms |
23132 KB |
Output is correct |
7 |
Correct |
6 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
143 ms |
66652 KB |
Output is correct |
10 |
Correct |
19 ms |
27204 KB |
Output is correct |
11 |
Correct |
73 ms |
46188 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 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 |
143 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
23128 KB |
Output is correct |
18 |
Correct |
7 ms |
23132 KB |
Output is correct |
19 |
Correct |
6 ms |
23132 KB |
Output is correct |
20 |
Correct |
365 ms |
133768 KB |
Output is correct |
21 |
Correct |
324 ms |
117112 KB |
Output is correct |
22 |
Correct |
390 ms |
117200 KB |
Output is correct |
23 |
Correct |
312 ms |
109480 KB |
Output is correct |
24 |
Correct |
66 ms |
34384 KB |
Output is correct |
25 |
Correct |
57 ms |
34384 KB |
Output is correct |
26 |
Correct |
60 ms |
34388 KB |
Output is correct |
27 |
Correct |
379 ms |
122456 KB |
Output is correct |
28 |
Correct |
385 ms |
122552 KB |
Output is correct |
29 |
Correct |
372 ms |
124076 KB |
Output is correct |
30 |
Correct |
395 ms |
124108 KB |
Output is correct |
31 |
Correct |
6 ms |
23132 KB |
Output is correct |
32 |
Correct |
2037 ms |
29516 KB |
Output is correct |
33 |
Correct |
50 ms |
38736 KB |
Output is correct |
34 |
Correct |
354 ms |
133756 KB |
Output is correct |
35 |
Correct |
10 ms |
23644 KB |
Output is correct |
36 |
Correct |
22 ms |
26244 KB |
Output is correct |
37 |
Correct |
36 ms |
29276 KB |
Output is correct |
38 |
Correct |
2203 ms |
59132 KB |
Output is correct |
39 |
Correct |
2312 ms |
72744 KB |
Output is correct |
40 |
Correct |
2382 ms |
86100 KB |
Output is correct |
41 |
Correct |
2483 ms |
99844 KB |
Output is correct |
42 |
Correct |
2609 ms |
113164 KB |
Output is correct |
43 |
Correct |
7 ms |
23128 KB |
Output is correct |
44 |
Correct |
7 ms |
23132 KB |
Output is correct |
45 |
Correct |
7 ms |
23132 KB |
Output is correct |
46 |
Correct |
6 ms |
23132 KB |
Output is correct |
47 |
Correct |
7 ms |
22964 KB |
Output is correct |
48 |
Correct |
6 ms |
23128 KB |
Output is correct |
49 |
Correct |
7 ms |
23132 KB |
Output is correct |
50 |
Correct |
6 ms |
23132 KB |
Output is correct |
51 |
Correct |
7 ms |
23132 KB |
Output is correct |
52 |
Correct |
6 ms |
23132 KB |
Output is correct |
53 |
Correct |
6 ms |
23132 KB |
Output is correct |
54 |
Correct |
7 ms |
23132 KB |
Output is correct |
55 |
Correct |
7 ms |
23208 KB |
Output is correct |
56 |
Correct |
176 ms |
68532 KB |
Output is correct |
57 |
Correct |
274 ms |
88700 KB |
Output is correct |
58 |
Correct |
259 ms |
88832 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 |
23036 KB |
Output is correct |
62 |
Correct |
300 ms |
108756 KB |
Output is correct |
63 |
Correct |
309 ms |
108836 KB |
Output is correct |
64 |
Correct |
301 ms |
108388 KB |
Output is correct |
65 |
Correct |
8 ms |
23388 KB |
Output is correct |
66 |
Correct |
9 ms |
23644 KB |
Output is correct |
67 |
Correct |
185 ms |
67096 KB |
Output is correct |
68 |
Correct |
274 ms |
88944 KB |
Output is correct |
69 |
Correct |
370 ms |
111356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 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 |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
6 ms |
23132 KB |
Output is correct |
7 |
Correct |
6 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
143 ms |
66652 KB |
Output is correct |
10 |
Correct |
19 ms |
27204 KB |
Output is correct |
11 |
Correct |
73 ms |
46188 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 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 |
143 ms |
66552 KB |
Output is correct |
17 |
Correct |
368 ms |
121448 KB |
Output is correct |
18 |
Correct |
368 ms |
129584 KB |
Output is correct |
19 |
Correct |
324 ms |
117112 KB |
Output is correct |
20 |
Correct |
367 ms |
108980 KB |
Output is correct |
21 |
Correct |
336 ms |
110420 KB |
Output is correct |
22 |
Correct |
6 ms |
23128 KB |
Output is correct |
23 |
Correct |
2077 ms |
37664 KB |
Output is correct |
24 |
Correct |
13 ms |
24408 KB |
Output is correct |
25 |
Correct |
27 ms |
27380 KB |
Output is correct |
26 |
Correct |
42 ms |
30292 KB |
Output is correct |
27 |
Correct |
2274 ms |
69412 KB |
Output is correct |
28 |
Correct |
2332 ms |
80588 KB |
Output is correct |
29 |
Correct |
2414 ms |
92056 KB |
Output is correct |
30 |
Correct |
2489 ms |
103292 KB |
Output is correct |
31 |
Correct |
2571 ms |
114036 KB |
Output is correct |
32 |
Correct |
319 ms |
112112 KB |
Output is correct |
33 |
Correct |
316 ms |
108796 KB |
Output is correct |
34 |
Correct |
8 ms |
23384 KB |
Output is correct |
35 |
Correct |
9 ms |
23644 KB |
Output is correct |
36 |
Correct |
171 ms |
66636 KB |
Output is correct |
37 |
Correct |
272 ms |
88396 KB |
Output is correct |
38 |
Correct |
363 ms |
110400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 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 |
6 ms |
23132 KB |
Output is correct |
5 |
Correct |
7 ms |
23132 KB |
Output is correct |
6 |
Correct |
6 ms |
23132 KB |
Output is correct |
7 |
Correct |
6 ms |
23132 KB |
Output is correct |
8 |
Correct |
7 ms |
23132 KB |
Output is correct |
9 |
Correct |
143 ms |
66652 KB |
Output is correct |
10 |
Correct |
19 ms |
27204 KB |
Output is correct |
11 |
Correct |
73 ms |
46188 KB |
Output is correct |
12 |
Correct |
25 ms |
29468 KB |
Output is correct |
13 |
Correct |
17 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 |
143 ms |
66552 KB |
Output is correct |
17 |
Correct |
7 ms |
23136 KB |
Output is correct |
18 |
Correct |
7 ms |
23132 KB |
Output is correct |
19 |
Correct |
7 ms |
23132 KB |
Output is correct |
20 |
Correct |
6 ms |
23132 KB |
Output is correct |
21 |
Correct |
7 ms |
22964 KB |
Output is correct |
22 |
Correct |
6 ms |
23132 KB |
Output is correct |
23 |
Correct |
318 ms |
108488 KB |
Output is correct |
24 |
Correct |
7 ms |
23132 KB |
Output is correct |
25 |
Correct |
10 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23132 KB |
Output is correct |
27 |
Correct |
8 ms |
23132 KB |
Output is correct |
28 |
Correct |
121 ms |
55632 KB |
Output is correct |
29 |
Correct |
187 ms |
73780 KB |
Output is correct |
30 |
Correct |
245 ms |
88372 KB |
Output is correct |
31 |
Correct |
333 ms |
108488 KB |
Output is correct |
32 |
Correct |
8 ms |
23132 KB |
Output is correct |
33 |
Correct |
6 ms |
23132 KB |
Output is correct |
34 |
Correct |
6 ms |
23132 KB |
Output is correct |
35 |
Correct |
6 ms |
23132 KB |
Output is correct |
36 |
Correct |
6 ms |
22968 KB |
Output is correct |
37 |
Correct |
6 ms |
23132 KB |
Output is correct |
38 |
Correct |
6 ms |
23132 KB |
Output is correct |
39 |
Correct |
6 ms |
23132 KB |
Output is correct |
40 |
Correct |
6 ms |
23132 KB |
Output is correct |
41 |
Correct |
6 ms |
23132 KB |
Output is correct |
42 |
Correct |
7 ms |
22964 KB |
Output is correct |
43 |
Correct |
7 ms |
23132 KB |
Output is correct |
44 |
Correct |
8 ms |
23132 KB |
Output is correct |
45 |
Correct |
167 ms |
68288 KB |
Output is correct |
46 |
Correct |
253 ms |
88728 KB |
Output is correct |
47 |
Correct |
263 ms |
88856 KB |
Output is correct |
48 |
Correct |
6 ms |
23132 KB |
Output is correct |
49 |
Correct |
6 ms |
23132 KB |
Output is correct |
50 |
Correct |
6 ms |
23132 KB |
Output is correct |
51 |
Correct |
6 ms |
23132 KB |
Output is correct |
52 |
Correct |
6 ms |
23132 KB |
Output is correct |
53 |
Correct |
6 ms |
23132 KB |
Output is correct |
54 |
Correct |
6 ms |
23132 KB |
Output is correct |
55 |
Correct |
312 ms |
106268 KB |
Output is correct |
56 |
Correct |
6 ms |
23132 KB |
Output is correct |
57 |
Correct |
75 ms |
23800 KB |
Output is correct |
58 |
Correct |
14 ms |
25688 KB |
Output is correct |
59 |
Correct |
10 ms |
23644 KB |
Output is correct |
60 |
Correct |
2968 ms |
66228 KB |
Output is correct |
61 |
Correct |
210 ms |
81292 KB |
Output is correct |
62 |
Correct |
263 ms |
92356 KB |
Output is correct |
63 |
Correct |
315 ms |
106132 KB |
Output is correct |
64 |
Correct |
6 ms |
23132 KB |
Output is correct |
65 |
Correct |
6 ms |
23132 KB |
Output is correct |
66 |
Correct |
6 ms |
23132 KB |
Output is correct |
67 |
Correct |
292 ms |
108824 KB |
Output is correct |
68 |
Correct |
302 ms |
108792 KB |
Output is correct |
69 |
Correct |
304 ms |
108560 KB |
Output is correct |
70 |
Correct |
8 ms |
23388 KB |
Output is correct |
71 |
Correct |
9 ms |
23564 KB |
Output is correct |
72 |
Correct |
176 ms |
66728 KB |
Output is correct |
73 |
Correct |
270 ms |
88928 KB |
Output is correct |
74 |
Correct |
377 ms |
111252 KB |
Output is correct |
75 |
Correct |
310 ms |
112096 KB |
Output is correct |
76 |
Correct |
295 ms |
108788 KB |
Output is correct |
77 |
Correct |
8 ms |
23388 KB |
Output is correct |
78 |
Correct |
9 ms |
23644 KB |
Output is correct |
79 |
Correct |
183 ms |
66852 KB |
Output is correct |
80 |
Correct |
262 ms |
88400 KB |
Output is correct |
81 |
Correct |
374 ms |
110480 KB |
Output is correct |
82 |
Correct |
7 ms |
23128 KB |
Output is correct |
83 |
Correct |
7 ms |
23132 KB |
Output is correct |
84 |
Correct |
6 ms |
23132 KB |
Output is correct |
85 |
Correct |
365 ms |
133768 KB |
Output is correct |
86 |
Correct |
324 ms |
117112 KB |
Output is correct |
87 |
Correct |
390 ms |
117200 KB |
Output is correct |
88 |
Correct |
312 ms |
109480 KB |
Output is correct |
89 |
Correct |
66 ms |
34384 KB |
Output is correct |
90 |
Correct |
57 ms |
34384 KB |
Output is correct |
91 |
Correct |
60 ms |
34388 KB |
Output is correct |
92 |
Correct |
379 ms |
122456 KB |
Output is correct |
93 |
Correct |
385 ms |
122552 KB |
Output is correct |
94 |
Correct |
372 ms |
124076 KB |
Output is correct |
95 |
Correct |
395 ms |
124108 KB |
Output is correct |
96 |
Correct |
6 ms |
23132 KB |
Output is correct |
97 |
Correct |
2037 ms |
29516 KB |
Output is correct |
98 |
Correct |
50 ms |
38736 KB |
Output is correct |
99 |
Correct |
354 ms |
133756 KB |
Output is correct |
100 |
Correct |
10 ms |
23644 KB |
Output is correct |
101 |
Correct |
22 ms |
26244 KB |
Output is correct |
102 |
Correct |
36 ms |
29276 KB |
Output is correct |
103 |
Correct |
2203 ms |
59132 KB |
Output is correct |
104 |
Correct |
2312 ms |
72744 KB |
Output is correct |
105 |
Correct |
2382 ms |
86100 KB |
Output is correct |
106 |
Correct |
2483 ms |
99844 KB |
Output is correct |
107 |
Correct |
2609 ms |
113164 KB |
Output is correct |
108 |
Correct |
7 ms |
23128 KB |
Output is correct |
109 |
Correct |
7 ms |
23132 KB |
Output is correct |
110 |
Correct |
7 ms |
23132 KB |
Output is correct |
111 |
Correct |
6 ms |
23132 KB |
Output is correct |
112 |
Correct |
7 ms |
22964 KB |
Output is correct |
113 |
Correct |
6 ms |
23128 KB |
Output is correct |
114 |
Correct |
7 ms |
23132 KB |
Output is correct |
115 |
Correct |
6 ms |
23132 KB |
Output is correct |
116 |
Correct |
7 ms |
23132 KB |
Output is correct |
117 |
Correct |
6 ms |
23132 KB |
Output is correct |
118 |
Correct |
6 ms |
23132 KB |
Output is correct |
119 |
Correct |
7 ms |
23132 KB |
Output is correct |
120 |
Correct |
7 ms |
23208 KB |
Output is correct |
121 |
Correct |
176 ms |
68532 KB |
Output is correct |
122 |
Correct |
274 ms |
88700 KB |
Output is correct |
123 |
Correct |
259 ms |
88832 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 |
23036 KB |
Output is correct |
127 |
Correct |
300 ms |
108756 KB |
Output is correct |
128 |
Correct |
309 ms |
108836 KB |
Output is correct |
129 |
Correct |
301 ms |
108388 KB |
Output is correct |
130 |
Correct |
8 ms |
23388 KB |
Output is correct |
131 |
Correct |
9 ms |
23644 KB |
Output is correct |
132 |
Correct |
185 ms |
67096 KB |
Output is correct |
133 |
Correct |
274 ms |
88944 KB |
Output is correct |
134 |
Correct |
370 ms |
111356 KB |
Output is correct |
135 |
Correct |
368 ms |
121448 KB |
Output is correct |
136 |
Correct |
368 ms |
129584 KB |
Output is correct |
137 |
Correct |
324 ms |
117112 KB |
Output is correct |
138 |
Correct |
367 ms |
108980 KB |
Output is correct |
139 |
Correct |
336 ms |
110420 KB |
Output is correct |
140 |
Correct |
6 ms |
23128 KB |
Output is correct |
141 |
Correct |
2077 ms |
37664 KB |
Output is correct |
142 |
Correct |
13 ms |
24408 KB |
Output is correct |
143 |
Correct |
27 ms |
27380 KB |
Output is correct |
144 |
Correct |
42 ms |
30292 KB |
Output is correct |
145 |
Correct |
2274 ms |
69412 KB |
Output is correct |
146 |
Correct |
2332 ms |
80588 KB |
Output is correct |
147 |
Correct |
2414 ms |
92056 KB |
Output is correct |
148 |
Correct |
2489 ms |
103292 KB |
Output is correct |
149 |
Correct |
2571 ms |
114036 KB |
Output is correct |
150 |
Correct |
319 ms |
112112 KB |
Output is correct |
151 |
Correct |
316 ms |
108796 KB |
Output is correct |
152 |
Correct |
8 ms |
23384 KB |
Output is correct |
153 |
Correct |
9 ms |
23644 KB |
Output is correct |
154 |
Correct |
171 ms |
66636 KB |
Output is correct |
155 |
Correct |
272 ms |
88396 KB |
Output is correct |
156 |
Correct |
363 ms |
110400 KB |
Output is correct |
157 |
Correct |
6 ms |
23132 KB |
Output is correct |
158 |
Correct |
7 ms |
23132 KB |
Output is correct |
159 |
Correct |
6 ms |
23132 KB |
Output is correct |
160 |
Correct |
7 ms |
22932 KB |
Output is correct |
161 |
Correct |
357 ms |
105624 KB |
Output is correct |
162 |
Correct |
381 ms |
133960 KB |
Output is correct |
163 |
Correct |
340 ms |
122748 KB |
Output is correct |
164 |
Correct |
361 ms |
122888 KB |
Output is correct |
165 |
Correct |
517 ms |
107992 KB |
Output is correct |
166 |
Correct |
1486 ms |
109352 KB |
Output is correct |
167 |
Execution timed out |
3516 ms |
33748 KB |
Time limit exceeded |
168 |
Halted |
0 ms |
0 KB |
- |