#include "parks.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;
const int MAXN = 200'000;
const int MAXND = MAXN * 2;
struct SCC {
vector<int> adj[MAXND + 10];
vector<int> rev[MAXND + 10];
int vis[MAXND + 10];
vector<int> stk;
void link(int x, int y) {
adj[x].eb(y);
rev[y].eb(x);
}
void bilink(int x, int y) {
link(x, y);
link(y, x);
}
void dfs1(int n) {
if(vis[n] < 0) return;
vis[n] = -1;
for(auto &i:rev[n]) dfs1(i);
stk.eb(n);
}
void dfs2(int n, int tag) {
if(vis[n] != -1) return;
vis[n] = tag;
for(auto &i:adj[n]) dfs2(i, tag);
}
int build_scc(int n) {
memset(vis, 0, sizeof(vis));
For(i, 0, n - 1) dfs1(i);
int cur_scc = 0;
while(sz(stk)) {
dfs2(stk.back(), cur_scc);
while(sz(stk) && vis[stk.back()] != -1) stk.pop_back();
cur_scc++;
}
return cur_scc;
}
} ayaya;
struct DSU {
int p[MAXN + 10];
void init() {
memset(p, -1, sizeof(p));
}
int find(int n) {
if(p[n] < 0) return n;
return p[n] = find(p[n]);
}
bool uni(int a, int b) {
a = find(a); b = find(b);
if(a == b) return false;
p[b] = a;
return true;
}
} dsu;
vector<pii> pos[MAXN + 10];
int construct_roads(std::vector<int> X, std::vector<int> Y) {
if (sz(X) == 1) {
build({}, {}, {}, {});
return 1;
}
int n = sz(X);
map<pii, int> mp;
For(i, 0, n - 1) {
mp[pii(X[i], Y[i])] = i;
pos[X[i]].eb(Y[i], i);
}
auto find = [&](int x, int y) {
if(mp.count(pii(x, y))) return mp[pii(x, y)];
return -1;
};
dsu.init();
int cnt = 0;
map<pii, int> hor, ver;
vector<int> U(n - 1), V(n - 1), A(n - 1), B(n - 1);
for(int x = 2; x <= MAXN; x += 2) {
for(auto &it:pos[x]) {
int y, i;
tie(y, i) = it;
auto link = [&](int x2, int y2) {
int j = find(x2, y2);
if(j >= 0 && dsu.uni(i, j)) {
if(x2 == x) ver[pii(x, max(y, y2))] = cnt;
else hor[pii(min(x, x2), y)] = cnt;
U[cnt] = i;
V[cnt] = j;
cnt++;
}
};
// link(x + 2, y);
link(x, y + 2);
}
}
for(int x = 2; x <= MAXN; x += 2) {
for(auto &it:pos[x]) {
int y, i;
tie(y, i) = it;
auto link = [&](int x2, int y2) {
int j = find(x2, y2);
if(j >= 0 && dsu.uni(i, j)) {
if(x2 == x) ver[pii(x, max(y, y2))] = cnt;
else hor[pii(min(x, x2), y)] = cnt;
U[cnt] = i;
V[cnt] = j;
cnt++;
}
};
link(x + 2, y);
// link(x, y + 2);
}
}
// For(i, 0, n - 1) {
// int x = X[i], y = Y[i];
// auto link = [&](int x2, int y2) {
// int j = find(x2, y2);
// if(j >= 0 && dsu.uni(i, j)) {
// if(x2 == x) ver[pii(x, max(y, y2))] = cnt;
// else hor[pii(min(x, x2), y)] = cnt;
// U[cnt] = i;
// V[cnt] = j;
// cnt++;
// }
// };
// const int dx[4] = {0, 0, 2, -2};
// const int dy[4] = {2, -2, 0, 0};
// For(it, 0, 3) link(x + dx[it], y + dy[it]);
// }
if(cnt != n - 1) return 0;
for(auto &it:ver) {
pii p; int id;
tie(p, id) = it;
int x, y;
tie(x, y) = p;
if(hor.count(pii(x - 2, y))) {
int id2 = hor[pii(x - 2, y)];
ayaya.link(id, id2);
ayaya.link(id2 + n, id + n);
}
if(hor.count(pii(x - 2, y - 2))) {
int id2 = hor[pii(x - 2, y - 2)];
ayaya.link(id, id2 + n);
ayaya.link(id2, id + n);
}
if(hor.count(pii(x, y))) {
int id2 = hor[pii(x, y)];
ayaya.link(id + n, id2);
ayaya.link(id2 + n, id);
}
if(hor.count(pii(x, y - 2))) {
int id2 = hor[pii(x, y - 2)];
ayaya.link(id + n, id2 + n);
ayaya.link(id2, id);
}
if(ver.count(pii(x + 2, y))) {
int id2 = ver[pii(x + 2, y)];
ayaya.link(id + n, id2 + n);
ayaya.link(id2, id);
}
}
for(auto &it:hor) {
pii p; int id;
tie(p, id) = it;
int x, y;
tie(x, y) = p;
if(hor.count(pii(x, y - 2))) {
int id2 = hor[pii(x, y - 2)];
ayaya.link(id + n, id2 + n);
ayaya.link(id2, id);
}
}
ayaya.build_scc(n * 2);
for(auto &it:ver) {
pii p; int id;
tie(p, id) = it;
int x, y;
tie(x, y) = p;
int s1 = ayaya.vis[id];
int s2 = ayaya.vis[id + n];
if(s1 == s2) return 0;
if(s1 < s2) {
A[id] = x - 1;
B[id] = y - 1;
} else {
A[id] = x + 1;
B[id] = y - 1;
}
}
for(auto &it:hor) {
pii p; int id;
tie(p, id) = it;
int x, y;
tie(x, y) = p;
int s1 = ayaya.vis[id];
int s2 = ayaya.vis[id + n];
if(s1 == s2) return 0;
if(s1 < s2) {
A[id] = x + 1;
B[id] = y + 1;
} else {
A[id] = x + 1;
B[id] = y - 1;
}
}
build(U, V, A, B);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
26140 KB |
Output is correct |
3 |
Correct |
13 ms |
24532 KB |
Output is correct |
4 |
Correct |
14 ms |
26068 KB |
Output is correct |
5 |
Correct |
16 ms |
26048 KB |
Output is correct |
6 |
Correct |
12 ms |
24560 KB |
Output is correct |
7 |
Correct |
13 ms |
24536 KB |
Output is correct |
8 |
Correct |
12 ms |
24524 KB |
Output is correct |
9 |
Correct |
178 ms |
47708 KB |
Output is correct |
10 |
Correct |
22 ms |
28308 KB |
Output is correct |
11 |
Correct |
88 ms |
37656 KB |
Output is correct |
12 |
Correct |
32 ms |
29372 KB |
Output is correct |
13 |
Correct |
44 ms |
31844 KB |
Output is correct |
14 |
Correct |
12 ms |
24688 KB |
Output is correct |
15 |
Correct |
14 ms |
24816 KB |
Output is correct |
16 |
Correct |
214 ms |
47704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
26140 KB |
Output is correct |
3 |
Correct |
13 ms |
24532 KB |
Output is correct |
4 |
Correct |
14 ms |
26068 KB |
Output is correct |
5 |
Correct |
16 ms |
26048 KB |
Output is correct |
6 |
Correct |
12 ms |
24560 KB |
Output is correct |
7 |
Correct |
13 ms |
24536 KB |
Output is correct |
8 |
Correct |
12 ms |
24524 KB |
Output is correct |
9 |
Correct |
178 ms |
47708 KB |
Output is correct |
10 |
Correct |
22 ms |
28308 KB |
Output is correct |
11 |
Correct |
88 ms |
37656 KB |
Output is correct |
12 |
Correct |
32 ms |
29372 KB |
Output is correct |
13 |
Correct |
44 ms |
31844 KB |
Output is correct |
14 |
Correct |
12 ms |
24688 KB |
Output is correct |
15 |
Correct |
14 ms |
24816 KB |
Output is correct |
16 |
Correct |
214 ms |
47704 KB |
Output is correct |
17 |
Correct |
13 ms |
26108 KB |
Output is correct |
18 |
Correct |
12 ms |
26032 KB |
Output is correct |
19 |
Correct |
15 ms |
26060 KB |
Output is correct |
20 |
Correct |
13 ms |
26016 KB |
Output is correct |
21 |
Correct |
12 ms |
24536 KB |
Output is correct |
22 |
Correct |
13 ms |
26128 KB |
Output is correct |
23 |
Correct |
588 ms |
79340 KB |
Output is correct |
24 |
Correct |
11 ms |
26096 KB |
Output is correct |
25 |
Correct |
20 ms |
26440 KB |
Output is correct |
26 |
Correct |
14 ms |
25000 KB |
Output is correct |
27 |
Correct |
14 ms |
25192 KB |
Output is correct |
28 |
Correct |
189 ms |
47344 KB |
Output is correct |
29 |
Correct |
280 ms |
58056 KB |
Output is correct |
30 |
Correct |
450 ms |
68724 KB |
Output is correct |
31 |
Correct |
568 ms |
79384 KB |
Output is correct |
32 |
Correct |
13 ms |
26068 KB |
Output is correct |
33 |
Correct |
14 ms |
26096 KB |
Output is correct |
34 |
Correct |
13 ms |
26040 KB |
Output is correct |
35 |
Correct |
14 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
14 ms |
26088 KB |
Output is correct |
38 |
Correct |
15 ms |
26068 KB |
Output is correct |
39 |
Correct |
13 ms |
26092 KB |
Output is correct |
40 |
Correct |
12 ms |
26068 KB |
Output is correct |
41 |
Correct |
13 ms |
24532 KB |
Output is correct |
42 |
Correct |
13 ms |
26068 KB |
Output is correct |
43 |
Correct |
14 ms |
24836 KB |
Output is correct |
44 |
Correct |
14 ms |
24972 KB |
Output is correct |
45 |
Correct |
260 ms |
54224 KB |
Output is correct |
46 |
Correct |
360 ms |
66860 KB |
Output is correct |
47 |
Correct |
411 ms |
67000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
26140 KB |
Output is correct |
3 |
Correct |
13 ms |
24532 KB |
Output is correct |
4 |
Correct |
14 ms |
26068 KB |
Output is correct |
5 |
Correct |
16 ms |
26048 KB |
Output is correct |
6 |
Correct |
12 ms |
24560 KB |
Output is correct |
7 |
Correct |
13 ms |
24536 KB |
Output is correct |
8 |
Correct |
12 ms |
24524 KB |
Output is correct |
9 |
Correct |
178 ms |
47708 KB |
Output is correct |
10 |
Correct |
22 ms |
28308 KB |
Output is correct |
11 |
Correct |
88 ms |
37656 KB |
Output is correct |
12 |
Correct |
32 ms |
29372 KB |
Output is correct |
13 |
Correct |
44 ms |
31844 KB |
Output is correct |
14 |
Correct |
12 ms |
24688 KB |
Output is correct |
15 |
Correct |
14 ms |
24816 KB |
Output is correct |
16 |
Correct |
214 ms |
47704 KB |
Output is correct |
17 |
Correct |
13 ms |
26108 KB |
Output is correct |
18 |
Correct |
12 ms |
26032 KB |
Output is correct |
19 |
Correct |
15 ms |
26060 KB |
Output is correct |
20 |
Correct |
13 ms |
26016 KB |
Output is correct |
21 |
Correct |
12 ms |
24536 KB |
Output is correct |
22 |
Correct |
13 ms |
26128 KB |
Output is correct |
23 |
Correct |
588 ms |
79340 KB |
Output is correct |
24 |
Correct |
11 ms |
26096 KB |
Output is correct |
25 |
Correct |
20 ms |
26440 KB |
Output is correct |
26 |
Correct |
14 ms |
25000 KB |
Output is correct |
27 |
Correct |
14 ms |
25192 KB |
Output is correct |
28 |
Correct |
189 ms |
47344 KB |
Output is correct |
29 |
Correct |
280 ms |
58056 KB |
Output is correct |
30 |
Correct |
450 ms |
68724 KB |
Output is correct |
31 |
Correct |
568 ms |
79384 KB |
Output is correct |
32 |
Correct |
13 ms |
26068 KB |
Output is correct |
33 |
Correct |
14 ms |
26096 KB |
Output is correct |
34 |
Correct |
13 ms |
26040 KB |
Output is correct |
35 |
Correct |
14 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
14 ms |
26088 KB |
Output is correct |
38 |
Correct |
15 ms |
26068 KB |
Output is correct |
39 |
Correct |
13 ms |
26092 KB |
Output is correct |
40 |
Correct |
12 ms |
26068 KB |
Output is correct |
41 |
Correct |
13 ms |
24532 KB |
Output is correct |
42 |
Correct |
13 ms |
26068 KB |
Output is correct |
43 |
Correct |
14 ms |
24836 KB |
Output is correct |
44 |
Correct |
14 ms |
24972 KB |
Output is correct |
45 |
Correct |
260 ms |
54224 KB |
Output is correct |
46 |
Correct |
360 ms |
66860 KB |
Output is correct |
47 |
Correct |
411 ms |
67000 KB |
Output is correct |
48 |
Correct |
13 ms |
26100 KB |
Output is correct |
49 |
Correct |
13 ms |
26096 KB |
Output is correct |
50 |
Correct |
13 ms |
26068 KB |
Output is correct |
51 |
Correct |
13 ms |
26112 KB |
Output is correct |
52 |
Correct |
13 ms |
26068 KB |
Output is correct |
53 |
Correct |
13 ms |
26116 KB |
Output is correct |
54 |
Correct |
15 ms |
26068 KB |
Output is correct |
55 |
Correct |
574 ms |
83552 KB |
Output is correct |
56 |
Correct |
15 ms |
26104 KB |
Output is correct |
57 |
Correct |
17 ms |
26580 KB |
Output is correct |
58 |
Correct |
22 ms |
27872 KB |
Output is correct |
59 |
Correct |
23 ms |
26156 KB |
Output is correct |
60 |
Correct |
230 ms |
54788 KB |
Output is correct |
61 |
Correct |
362 ms |
64856 KB |
Output is correct |
62 |
Correct |
439 ms |
73404 KB |
Output is correct |
63 |
Correct |
606 ms |
83512 KB |
Output is correct |
64 |
Correct |
13 ms |
24532 KB |
Output is correct |
65 |
Correct |
13 ms |
26068 KB |
Output is correct |
66 |
Correct |
14 ms |
24532 KB |
Output is correct |
67 |
Correct |
404 ms |
66752 KB |
Output is correct |
68 |
Correct |
456 ms |
66820 KB |
Output is correct |
69 |
Correct |
397 ms |
66644 KB |
Output is correct |
70 |
Correct |
15 ms |
25172 KB |
Output is correct |
71 |
Correct |
20 ms |
25812 KB |
Output is correct |
72 |
Correct |
244 ms |
54832 KB |
Output is correct |
73 |
Correct |
412 ms |
69232 KB |
Output is correct |
74 |
Correct |
596 ms |
83544 KB |
Output is correct |
75 |
Correct |
555 ms |
76784 KB |
Output is correct |
76 |
Correct |
397 ms |
66748 KB |
Output is correct |
77 |
Correct |
20 ms |
25304 KB |
Output is correct |
78 |
Correct |
20 ms |
26044 KB |
Output is correct |
79 |
Correct |
244 ms |
53748 KB |
Output is correct |
80 |
Correct |
394 ms |
67452 KB |
Output is correct |
81 |
Correct |
554 ms |
81200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
26140 KB |
Output is correct |
3 |
Correct |
13 ms |
24532 KB |
Output is correct |
4 |
Correct |
14 ms |
26068 KB |
Output is correct |
5 |
Correct |
16 ms |
26048 KB |
Output is correct |
6 |
Correct |
12 ms |
24560 KB |
Output is correct |
7 |
Correct |
13 ms |
24536 KB |
Output is correct |
8 |
Correct |
12 ms |
24524 KB |
Output is correct |
9 |
Correct |
178 ms |
47708 KB |
Output is correct |
10 |
Correct |
22 ms |
28308 KB |
Output is correct |
11 |
Correct |
88 ms |
37656 KB |
Output is correct |
12 |
Correct |
32 ms |
29372 KB |
Output is correct |
13 |
Correct |
44 ms |
31844 KB |
Output is correct |
14 |
Correct |
12 ms |
24688 KB |
Output is correct |
15 |
Correct |
14 ms |
24816 KB |
Output is correct |
16 |
Correct |
214 ms |
47704 KB |
Output is correct |
17 |
Correct |
13 ms |
26068 KB |
Output is correct |
18 |
Correct |
15 ms |
26068 KB |
Output is correct |
19 |
Correct |
12 ms |
24480 KB |
Output is correct |
20 |
Correct |
469 ms |
99080 KB |
Output is correct |
21 |
Correct |
450 ms |
95540 KB |
Output is correct |
22 |
Correct |
481 ms |
95448 KB |
Output is correct |
23 |
Correct |
313 ms |
62056 KB |
Output is correct |
24 |
Correct |
157 ms |
45004 KB |
Output is correct |
25 |
Correct |
243 ms |
57428 KB |
Output is correct |
26 |
Correct |
231 ms |
57424 KB |
Output is correct |
27 |
Correct |
322 ms |
67000 KB |
Output is correct |
28 |
Correct |
326 ms |
66948 KB |
Output is correct |
29 |
Correct |
362 ms |
67396 KB |
Output is correct |
30 |
Correct |
345 ms |
67392 KB |
Output is correct |
31 |
Correct |
15 ms |
26068 KB |
Output is correct |
32 |
Correct |
38 ms |
30636 KB |
Output is correct |
33 |
Correct |
121 ms |
37092 KB |
Output is correct |
34 |
Correct |
463 ms |
99136 KB |
Output is correct |
35 |
Correct |
20 ms |
26196 KB |
Output is correct |
36 |
Correct |
68 ms |
32956 KB |
Output is correct |
37 |
Correct |
115 ms |
41456 KB |
Output is correct |
38 |
Correct |
177 ms |
50892 KB |
Output is correct |
39 |
Correct |
232 ms |
60336 KB |
Output is correct |
40 |
Correct |
333 ms |
69760 KB |
Output is correct |
41 |
Correct |
417 ms |
79028 KB |
Output is correct |
42 |
Correct |
499 ms |
88452 KB |
Output is correct |
43 |
Correct |
13 ms |
26068 KB |
Output is correct |
44 |
Correct |
13 ms |
26032 KB |
Output is correct |
45 |
Correct |
14 ms |
26068 KB |
Output is correct |
46 |
Correct |
12 ms |
24528 KB |
Output is correct |
47 |
Correct |
13 ms |
24504 KB |
Output is correct |
48 |
Correct |
13 ms |
26068 KB |
Output is correct |
49 |
Correct |
13 ms |
26068 KB |
Output is correct |
50 |
Correct |
13 ms |
26116 KB |
Output is correct |
51 |
Correct |
15 ms |
26068 KB |
Output is correct |
52 |
Correct |
16 ms |
24532 KB |
Output is correct |
53 |
Correct |
13 ms |
26080 KB |
Output is correct |
54 |
Correct |
13 ms |
24788 KB |
Output is correct |
55 |
Correct |
17 ms |
24960 KB |
Output is correct |
56 |
Correct |
270 ms |
54224 KB |
Output is correct |
57 |
Correct |
407 ms |
66876 KB |
Output is correct |
58 |
Correct |
409 ms |
66848 KB |
Output is correct |
59 |
Correct |
14 ms |
24500 KB |
Output is correct |
60 |
Correct |
14 ms |
26076 KB |
Output is correct |
61 |
Correct |
11 ms |
24532 KB |
Output is correct |
62 |
Correct |
474 ms |
66748 KB |
Output is correct |
63 |
Correct |
515 ms |
66736 KB |
Output is correct |
64 |
Correct |
443 ms |
66612 KB |
Output is correct |
65 |
Correct |
16 ms |
25140 KB |
Output is correct |
66 |
Correct |
20 ms |
25852 KB |
Output is correct |
67 |
Correct |
331 ms |
54868 KB |
Output is correct |
68 |
Correct |
406 ms |
69168 KB |
Output is correct |
69 |
Correct |
567 ms |
83528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
26140 KB |
Output is correct |
3 |
Correct |
13 ms |
24532 KB |
Output is correct |
4 |
Correct |
14 ms |
26068 KB |
Output is correct |
5 |
Correct |
16 ms |
26048 KB |
Output is correct |
6 |
Correct |
12 ms |
24560 KB |
Output is correct |
7 |
Correct |
13 ms |
24536 KB |
Output is correct |
8 |
Correct |
12 ms |
24524 KB |
Output is correct |
9 |
Correct |
178 ms |
47708 KB |
Output is correct |
10 |
Correct |
22 ms |
28308 KB |
Output is correct |
11 |
Correct |
88 ms |
37656 KB |
Output is correct |
12 |
Correct |
32 ms |
29372 KB |
Output is correct |
13 |
Correct |
44 ms |
31844 KB |
Output is correct |
14 |
Correct |
12 ms |
24688 KB |
Output is correct |
15 |
Correct |
14 ms |
24816 KB |
Output is correct |
16 |
Correct |
214 ms |
47704 KB |
Output is correct |
17 |
Correct |
424 ms |
67592 KB |
Output is correct |
18 |
Correct |
383 ms |
67656 KB |
Output is correct |
19 |
Correct |
523 ms |
95432 KB |
Output is correct |
20 |
Correct |
421 ms |
82336 KB |
Output is correct |
21 |
Correct |
325 ms |
67696 KB |
Output is correct |
22 |
Correct |
14 ms |
26040 KB |
Output is correct |
23 |
Correct |
66 ms |
36024 KB |
Output is correct |
24 |
Correct |
32 ms |
27944 KB |
Output is correct |
25 |
Correct |
78 ms |
36356 KB |
Output is correct |
26 |
Correct |
150 ms |
44812 KB |
Output is correct |
27 |
Correct |
213 ms |
55988 KB |
Output is correct |
28 |
Correct |
284 ms |
63776 KB |
Output is correct |
29 |
Correct |
327 ms |
71068 KB |
Output is correct |
30 |
Correct |
399 ms |
78244 KB |
Output is correct |
31 |
Correct |
465 ms |
85772 KB |
Output is correct |
32 |
Correct |
528 ms |
76840 KB |
Output is correct |
33 |
Correct |
402 ms |
66852 KB |
Output is correct |
34 |
Correct |
16 ms |
25300 KB |
Output is correct |
35 |
Correct |
20 ms |
26032 KB |
Output is correct |
36 |
Correct |
232 ms |
53684 KB |
Output is correct |
37 |
Correct |
401 ms |
67284 KB |
Output is correct |
38 |
Correct |
600 ms |
81040 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
26140 KB |
Output is correct |
3 |
Correct |
13 ms |
24532 KB |
Output is correct |
4 |
Correct |
14 ms |
26068 KB |
Output is correct |
5 |
Correct |
16 ms |
26048 KB |
Output is correct |
6 |
Correct |
12 ms |
24560 KB |
Output is correct |
7 |
Correct |
13 ms |
24536 KB |
Output is correct |
8 |
Correct |
12 ms |
24524 KB |
Output is correct |
9 |
Correct |
178 ms |
47708 KB |
Output is correct |
10 |
Correct |
22 ms |
28308 KB |
Output is correct |
11 |
Correct |
88 ms |
37656 KB |
Output is correct |
12 |
Correct |
32 ms |
29372 KB |
Output is correct |
13 |
Correct |
44 ms |
31844 KB |
Output is correct |
14 |
Correct |
12 ms |
24688 KB |
Output is correct |
15 |
Correct |
14 ms |
24816 KB |
Output is correct |
16 |
Correct |
214 ms |
47704 KB |
Output is correct |
17 |
Correct |
13 ms |
26108 KB |
Output is correct |
18 |
Correct |
12 ms |
26032 KB |
Output is correct |
19 |
Correct |
15 ms |
26060 KB |
Output is correct |
20 |
Correct |
13 ms |
26016 KB |
Output is correct |
21 |
Correct |
12 ms |
24536 KB |
Output is correct |
22 |
Correct |
13 ms |
26128 KB |
Output is correct |
23 |
Correct |
588 ms |
79340 KB |
Output is correct |
24 |
Correct |
11 ms |
26096 KB |
Output is correct |
25 |
Correct |
20 ms |
26440 KB |
Output is correct |
26 |
Correct |
14 ms |
25000 KB |
Output is correct |
27 |
Correct |
14 ms |
25192 KB |
Output is correct |
28 |
Correct |
189 ms |
47344 KB |
Output is correct |
29 |
Correct |
280 ms |
58056 KB |
Output is correct |
30 |
Correct |
450 ms |
68724 KB |
Output is correct |
31 |
Correct |
568 ms |
79384 KB |
Output is correct |
32 |
Correct |
13 ms |
26068 KB |
Output is correct |
33 |
Correct |
14 ms |
26096 KB |
Output is correct |
34 |
Correct |
13 ms |
26040 KB |
Output is correct |
35 |
Correct |
14 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
14 ms |
26088 KB |
Output is correct |
38 |
Correct |
15 ms |
26068 KB |
Output is correct |
39 |
Correct |
13 ms |
26092 KB |
Output is correct |
40 |
Correct |
12 ms |
26068 KB |
Output is correct |
41 |
Correct |
13 ms |
24532 KB |
Output is correct |
42 |
Correct |
13 ms |
26068 KB |
Output is correct |
43 |
Correct |
14 ms |
24836 KB |
Output is correct |
44 |
Correct |
14 ms |
24972 KB |
Output is correct |
45 |
Correct |
260 ms |
54224 KB |
Output is correct |
46 |
Correct |
360 ms |
66860 KB |
Output is correct |
47 |
Correct |
411 ms |
67000 KB |
Output is correct |
48 |
Correct |
13 ms |
26100 KB |
Output is correct |
49 |
Correct |
13 ms |
26096 KB |
Output is correct |
50 |
Correct |
13 ms |
26068 KB |
Output is correct |
51 |
Correct |
13 ms |
26112 KB |
Output is correct |
52 |
Correct |
13 ms |
26068 KB |
Output is correct |
53 |
Correct |
13 ms |
26116 KB |
Output is correct |
54 |
Correct |
15 ms |
26068 KB |
Output is correct |
55 |
Correct |
574 ms |
83552 KB |
Output is correct |
56 |
Correct |
15 ms |
26104 KB |
Output is correct |
57 |
Correct |
17 ms |
26580 KB |
Output is correct |
58 |
Correct |
22 ms |
27872 KB |
Output is correct |
59 |
Correct |
23 ms |
26156 KB |
Output is correct |
60 |
Correct |
230 ms |
54788 KB |
Output is correct |
61 |
Correct |
362 ms |
64856 KB |
Output is correct |
62 |
Correct |
439 ms |
73404 KB |
Output is correct |
63 |
Correct |
606 ms |
83512 KB |
Output is correct |
64 |
Correct |
13 ms |
24532 KB |
Output is correct |
65 |
Correct |
13 ms |
26068 KB |
Output is correct |
66 |
Correct |
14 ms |
24532 KB |
Output is correct |
67 |
Correct |
404 ms |
66752 KB |
Output is correct |
68 |
Correct |
456 ms |
66820 KB |
Output is correct |
69 |
Correct |
397 ms |
66644 KB |
Output is correct |
70 |
Correct |
15 ms |
25172 KB |
Output is correct |
71 |
Correct |
20 ms |
25812 KB |
Output is correct |
72 |
Correct |
244 ms |
54832 KB |
Output is correct |
73 |
Correct |
412 ms |
69232 KB |
Output is correct |
74 |
Correct |
596 ms |
83544 KB |
Output is correct |
75 |
Correct |
555 ms |
76784 KB |
Output is correct |
76 |
Correct |
397 ms |
66748 KB |
Output is correct |
77 |
Correct |
20 ms |
25304 KB |
Output is correct |
78 |
Correct |
20 ms |
26044 KB |
Output is correct |
79 |
Correct |
244 ms |
53748 KB |
Output is correct |
80 |
Correct |
394 ms |
67452 KB |
Output is correct |
81 |
Correct |
554 ms |
81200 KB |
Output is correct |
82 |
Correct |
13 ms |
26068 KB |
Output is correct |
83 |
Correct |
15 ms |
26068 KB |
Output is correct |
84 |
Correct |
12 ms |
24480 KB |
Output is correct |
85 |
Correct |
469 ms |
99080 KB |
Output is correct |
86 |
Correct |
450 ms |
95540 KB |
Output is correct |
87 |
Correct |
481 ms |
95448 KB |
Output is correct |
88 |
Correct |
313 ms |
62056 KB |
Output is correct |
89 |
Correct |
157 ms |
45004 KB |
Output is correct |
90 |
Correct |
243 ms |
57428 KB |
Output is correct |
91 |
Correct |
231 ms |
57424 KB |
Output is correct |
92 |
Correct |
322 ms |
67000 KB |
Output is correct |
93 |
Correct |
326 ms |
66948 KB |
Output is correct |
94 |
Correct |
362 ms |
67396 KB |
Output is correct |
95 |
Correct |
345 ms |
67392 KB |
Output is correct |
96 |
Correct |
15 ms |
26068 KB |
Output is correct |
97 |
Correct |
38 ms |
30636 KB |
Output is correct |
98 |
Correct |
121 ms |
37092 KB |
Output is correct |
99 |
Correct |
463 ms |
99136 KB |
Output is correct |
100 |
Correct |
20 ms |
26196 KB |
Output is correct |
101 |
Correct |
68 ms |
32956 KB |
Output is correct |
102 |
Correct |
115 ms |
41456 KB |
Output is correct |
103 |
Correct |
177 ms |
50892 KB |
Output is correct |
104 |
Correct |
232 ms |
60336 KB |
Output is correct |
105 |
Correct |
333 ms |
69760 KB |
Output is correct |
106 |
Correct |
417 ms |
79028 KB |
Output is correct |
107 |
Correct |
499 ms |
88452 KB |
Output is correct |
108 |
Correct |
13 ms |
26068 KB |
Output is correct |
109 |
Correct |
13 ms |
26032 KB |
Output is correct |
110 |
Correct |
14 ms |
26068 KB |
Output is correct |
111 |
Correct |
12 ms |
24528 KB |
Output is correct |
112 |
Correct |
13 ms |
24504 KB |
Output is correct |
113 |
Correct |
13 ms |
26068 KB |
Output is correct |
114 |
Correct |
13 ms |
26068 KB |
Output is correct |
115 |
Correct |
13 ms |
26116 KB |
Output is correct |
116 |
Correct |
15 ms |
26068 KB |
Output is correct |
117 |
Correct |
16 ms |
24532 KB |
Output is correct |
118 |
Correct |
13 ms |
26080 KB |
Output is correct |
119 |
Correct |
13 ms |
24788 KB |
Output is correct |
120 |
Correct |
17 ms |
24960 KB |
Output is correct |
121 |
Correct |
270 ms |
54224 KB |
Output is correct |
122 |
Correct |
407 ms |
66876 KB |
Output is correct |
123 |
Correct |
409 ms |
66848 KB |
Output is correct |
124 |
Correct |
14 ms |
24500 KB |
Output is correct |
125 |
Correct |
14 ms |
26076 KB |
Output is correct |
126 |
Correct |
11 ms |
24532 KB |
Output is correct |
127 |
Correct |
474 ms |
66748 KB |
Output is correct |
128 |
Correct |
515 ms |
66736 KB |
Output is correct |
129 |
Correct |
443 ms |
66612 KB |
Output is correct |
130 |
Correct |
16 ms |
25140 KB |
Output is correct |
131 |
Correct |
20 ms |
25852 KB |
Output is correct |
132 |
Correct |
331 ms |
54868 KB |
Output is correct |
133 |
Correct |
406 ms |
69168 KB |
Output is correct |
134 |
Correct |
567 ms |
83528 KB |
Output is correct |
135 |
Correct |
424 ms |
67592 KB |
Output is correct |
136 |
Correct |
383 ms |
67656 KB |
Output is correct |
137 |
Correct |
523 ms |
95432 KB |
Output is correct |
138 |
Correct |
421 ms |
82336 KB |
Output is correct |
139 |
Correct |
325 ms |
67696 KB |
Output is correct |
140 |
Correct |
14 ms |
26040 KB |
Output is correct |
141 |
Correct |
66 ms |
36024 KB |
Output is correct |
142 |
Correct |
32 ms |
27944 KB |
Output is correct |
143 |
Correct |
78 ms |
36356 KB |
Output is correct |
144 |
Correct |
150 ms |
44812 KB |
Output is correct |
145 |
Correct |
213 ms |
55988 KB |
Output is correct |
146 |
Correct |
284 ms |
63776 KB |
Output is correct |
147 |
Correct |
327 ms |
71068 KB |
Output is correct |
148 |
Correct |
399 ms |
78244 KB |
Output is correct |
149 |
Correct |
465 ms |
85772 KB |
Output is correct |
150 |
Correct |
528 ms |
76840 KB |
Output is correct |
151 |
Correct |
402 ms |
66852 KB |
Output is correct |
152 |
Correct |
16 ms |
25300 KB |
Output is correct |
153 |
Correct |
20 ms |
26032 KB |
Output is correct |
154 |
Correct |
232 ms |
53684 KB |
Output is correct |
155 |
Correct |
401 ms |
67284 KB |
Output is correct |
156 |
Correct |
600 ms |
81040 KB |
Output is correct |
157 |
Correct |
15 ms |
26124 KB |
Output is correct |
158 |
Correct |
16 ms |
24532 KB |
Output is correct |
159 |
Correct |
13 ms |
26068 KB |
Output is correct |
160 |
Correct |
14 ms |
26068 KB |
Output is correct |
161 |
Incorrect |
489 ms |
86268 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |