#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '['; string sep = ""; for (const auto &x : v) os << sep << x, sep = ", "; return os << ']'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename A> ostream& operator<<(ostream &os, const set<A> &s) { os << '{'; string sep = ""; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const map<A, B> &m) { os << '{'; string sep = ""; for (const auto &x : m) os << sep << x.first << " -> " << x.second, sep = ", "; return os << '}'; }
void debug() { cerr << endl; }
template<typename Ini, typename... Fim> void debug(Ini I, Fim... F) { cerr << I; if(sizeof...(F)) cerr << ", "; debug(F...);}
#define db(...) cerr << "DEBUG (" << #__VA_ARGS__ << ") == ", debug(__VA_ARGS__)
#define pb push_back
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
constexpr int inf = 0x3f3f3f3f;
constexpr int maxn = 8e5 + 10;
mt19937 rng(random_device{}());
int rnd(int x) { return (rng() % x + x) % x; }
vector<int> g[maxn];
int match[maxn];
bool mark[maxn];
int t, n, qtd_ruas;
bool dfs(int u) {
mark[u] = 1;
if(u >= qtd_ruas) return (match[u] == -1 ? 1 : dfs(match[u]));
for(int v : g[u]) {
if(mark[v] || !dfs(v)) continue;
match[u] = v; match[v] = u;
return 1;
}
return 0;
}
struct Road { // todas as ruas possiveis
int x, y, tipo; // ponto inicial da rua e se é vertical ou horizontal
} ruas[maxn];
pii conecta[maxn];
struct Banco {
int x, y;
} bancos[maxn];
map<pair<int,int>, int> mp; // salva o id dos pontos
inline void add(int a, int b) { g[a].pb(b), g[b].pb(a); }
int get(pii p) {
if(mp.count(p)) return mp[p];
bancos[t] = {p.ff, p.ss};
return mp[p] = t++;
}
bool mark2[maxn];
int vis = 0;
void vai(int x, int y) {
++vis;
int id = mp[pii(x, y)];
mark2[id] = 1;
vector<int> gld(4); iota(all(gld), 0); shuffle(all(gld), rng);
for(int opa : gld) {
if(opa == 0 && mp.count({x+2, y}) && !mark2[mp[pii(x+2, y)]]) {
conecta[t] = {id, mp[pii(x+2, y)]};
ruas[t++] = {x, y, 0};
// db(x, y, x+2, y);
vai(x+2, y);
}
if(opa == 1 && mp.count({x-2, y}) && !mark2[mp[pii(x-2, y)]]) {
conecta[t] = {mp[pii(x-2, y)], id};
ruas[t++] = {x-2, y, 0};
// db(x, y, x-2, y);
vai(x-2, y);
}
if(opa == 2 && mp.count({x, y+2}) && !mark2[mp[pii(x, y+2)]]) {
conecta[t] = {id, mp[pii(x, y+2)]};
ruas[t++] = {x, y, 1};
// db(x, y, x, y+2);
vai(x, y+2);
}
if(opa == 3 && mp.count({x, y-2}) && !mark2[mp[pii(x, y-2)]]) {
conecta[t] = {mp[pii(x, y-2)], id};
ruas[t++] = {x, y-2, 1};
// db(x, y, x, y-2);
vai(x, y-2);
}
}
}
int bonitao(vector<int> x, vector<int> y) {
mp.clear(); vis = t = n = qtd_ruas = 0;
memset(bancos, 0, sizeof bancos);
memset(mark, 0, sizeof mark);
memset(mark2, 0, sizeof mark2);
memset(match, 0, sizeof match);
for(int i = 0; i < maxn; i++)
g[i].clear(), conecta[i] = {0, 0};
n = sz(x);
for(int i = 0; i < n; i++)
mp[pii(x[i], y[i])] = i;
int hm = rnd(n);
vai(x[hm], y[hm]);
if(vis != n) return -1; // impossivel, o grafo completo não é conexo
qtd_ruas = t;
for(int i = 0; i < qtd_ruas; i++) {
auto [X, Y, tipo] = ruas[i];
if(!tipo) {
int aq = get({X+1, Y+1});
add(i, aq);
aq = get({X+1, Y-1});
add(i, aq);
} else {
int aq = get({X+1, Y+1});
add(i, aq);
aq = get({X-1, Y+1});
add(i, aq);
}
}
int ans = 0;
memset(match, -1, sizeof match);
vector<int> p(qtd_ruas); iota(all(p), 0);
for(int i = 0; i < t; i++)
shuffle(all(g[i]), rng);
for(int antes = -1; ans != antes;) {
antes = ans;
memset(mark, 0, sizeof mark);
shuffle(all(p), rng);
for(int i = 0; i < qtd_ruas; i++)
if(!mark[p[i]] && match[p[i]] == -1 && dfs(p[i])) ++ans;
}
if(ans != qtd_ruas) return 0;
vector<int> u(qtd_ruas), v(qtd_ruas), a(qtd_ruas), b(qtd_ruas);
for(int i = 0; i < qtd_ruas; i++) {
u[i] = conecta[i].ff, v[i] = conecta[i].ss;
a[i] = bancos[match[i]].x, b[i] = bancos[match[i]].y;
}
build(u, v, a, b);
return 1;
}
int construct_roads(vector<int> x, vector<int> y) {
for(int i = 0; i < 5; i++) {
int a = bonitao(x, y);
if(a == -1) return 0;
if(a == 0) continue;
return 1;
}
assert(0);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
36200 KB |
Output is correct |
2 |
Correct |
22 ms |
36300 KB |
Output is correct |
3 |
Correct |
22 ms |
36252 KB |
Output is correct |
4 |
Correct |
24 ms |
36300 KB |
Output is correct |
5 |
Correct |
23 ms |
36200 KB |
Output is correct |
6 |
Correct |
21 ms |
36292 KB |
Output is correct |
7 |
Correct |
22 ms |
36300 KB |
Output is correct |
8 |
Correct |
23 ms |
36264 KB |
Output is correct |
9 |
Correct |
347 ms |
83472 KB |
Output is correct |
10 |
Correct |
51 ms |
42000 KB |
Output is correct |
11 |
Correct |
198 ms |
62848 KB |
Output is correct |
12 |
Correct |
66 ms |
44188 KB |
Output is correct |
13 |
Correct |
73 ms |
44804 KB |
Output is correct |
14 |
Correct |
24 ms |
36376 KB |
Output is correct |
15 |
Correct |
24 ms |
36540 KB |
Output is correct |
16 |
Correct |
347 ms |
84936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
36200 KB |
Output is correct |
2 |
Correct |
22 ms |
36300 KB |
Output is correct |
3 |
Correct |
22 ms |
36252 KB |
Output is correct |
4 |
Correct |
24 ms |
36300 KB |
Output is correct |
5 |
Correct |
23 ms |
36200 KB |
Output is correct |
6 |
Correct |
21 ms |
36292 KB |
Output is correct |
7 |
Correct |
22 ms |
36300 KB |
Output is correct |
8 |
Correct |
23 ms |
36264 KB |
Output is correct |
9 |
Correct |
347 ms |
83472 KB |
Output is correct |
10 |
Correct |
51 ms |
42000 KB |
Output is correct |
11 |
Correct |
198 ms |
62848 KB |
Output is correct |
12 |
Correct |
66 ms |
44188 KB |
Output is correct |
13 |
Correct |
73 ms |
44804 KB |
Output is correct |
14 |
Correct |
24 ms |
36376 KB |
Output is correct |
15 |
Correct |
24 ms |
36540 KB |
Output is correct |
16 |
Correct |
347 ms |
84936 KB |
Output is correct |
17 |
Correct |
23 ms |
36248 KB |
Output is correct |
18 |
Correct |
23 ms |
36292 KB |
Output is correct |
19 |
Correct |
23 ms |
36412 KB |
Output is correct |
20 |
Correct |
23 ms |
36236 KB |
Output is correct |
21 |
Correct |
21 ms |
36260 KB |
Output is correct |
22 |
Correct |
23 ms |
36248 KB |
Output is correct |
23 |
Correct |
750 ms |
115212 KB |
Output is correct |
24 |
Correct |
24 ms |
36300 KB |
Output is correct |
25 |
Correct |
26 ms |
36748 KB |
Output is correct |
26 |
Correct |
25 ms |
36736 KB |
Output is correct |
27 |
Correct |
25 ms |
36600 KB |
Output is correct |
28 |
Correct |
286 ms |
70796 KB |
Output is correct |
29 |
Correct |
432 ms |
82884 KB |
Output is correct |
30 |
Correct |
616 ms |
104516 KB |
Output is correct |
31 |
Correct |
764 ms |
116932 KB |
Output is correct |
32 |
Correct |
22 ms |
36292 KB |
Output is correct |
33 |
Correct |
23 ms |
36232 KB |
Output is correct |
34 |
Correct |
23 ms |
36204 KB |
Output is correct |
35 |
Correct |
23 ms |
36200 KB |
Output is correct |
36 |
Correct |
23 ms |
36316 KB |
Output is correct |
37 |
Correct |
22 ms |
36292 KB |
Output is correct |
38 |
Correct |
23 ms |
36300 KB |
Output is correct |
39 |
Correct |
23 ms |
36300 KB |
Output is correct |
40 |
Correct |
23 ms |
36276 KB |
Output is correct |
41 |
Correct |
21 ms |
36300 KB |
Output is correct |
42 |
Correct |
23 ms |
36180 KB |
Output is correct |
43 |
Correct |
25 ms |
36552 KB |
Output is correct |
44 |
Correct |
25 ms |
36660 KB |
Output is correct |
45 |
Correct |
348 ms |
81704 KB |
Output is correct |
46 |
Correct |
528 ms |
93580 KB |
Output is correct |
47 |
Correct |
524 ms |
92304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
36200 KB |
Output is correct |
2 |
Correct |
22 ms |
36300 KB |
Output is correct |
3 |
Correct |
22 ms |
36252 KB |
Output is correct |
4 |
Correct |
24 ms |
36300 KB |
Output is correct |
5 |
Correct |
23 ms |
36200 KB |
Output is correct |
6 |
Correct |
21 ms |
36292 KB |
Output is correct |
7 |
Correct |
22 ms |
36300 KB |
Output is correct |
8 |
Correct |
23 ms |
36264 KB |
Output is correct |
9 |
Correct |
347 ms |
83472 KB |
Output is correct |
10 |
Correct |
51 ms |
42000 KB |
Output is correct |
11 |
Correct |
198 ms |
62848 KB |
Output is correct |
12 |
Correct |
66 ms |
44188 KB |
Output is correct |
13 |
Correct |
73 ms |
44804 KB |
Output is correct |
14 |
Correct |
24 ms |
36376 KB |
Output is correct |
15 |
Correct |
24 ms |
36540 KB |
Output is correct |
16 |
Correct |
347 ms |
84936 KB |
Output is correct |
17 |
Correct |
23 ms |
36248 KB |
Output is correct |
18 |
Correct |
23 ms |
36292 KB |
Output is correct |
19 |
Correct |
23 ms |
36412 KB |
Output is correct |
20 |
Correct |
23 ms |
36236 KB |
Output is correct |
21 |
Correct |
21 ms |
36260 KB |
Output is correct |
22 |
Correct |
23 ms |
36248 KB |
Output is correct |
23 |
Correct |
750 ms |
115212 KB |
Output is correct |
24 |
Correct |
24 ms |
36300 KB |
Output is correct |
25 |
Correct |
26 ms |
36748 KB |
Output is correct |
26 |
Correct |
25 ms |
36736 KB |
Output is correct |
27 |
Correct |
25 ms |
36600 KB |
Output is correct |
28 |
Correct |
286 ms |
70796 KB |
Output is correct |
29 |
Correct |
432 ms |
82884 KB |
Output is correct |
30 |
Correct |
616 ms |
104516 KB |
Output is correct |
31 |
Correct |
764 ms |
116932 KB |
Output is correct |
32 |
Correct |
22 ms |
36292 KB |
Output is correct |
33 |
Correct |
23 ms |
36232 KB |
Output is correct |
34 |
Correct |
23 ms |
36204 KB |
Output is correct |
35 |
Correct |
23 ms |
36200 KB |
Output is correct |
36 |
Correct |
23 ms |
36316 KB |
Output is correct |
37 |
Correct |
22 ms |
36292 KB |
Output is correct |
38 |
Correct |
23 ms |
36300 KB |
Output is correct |
39 |
Correct |
23 ms |
36300 KB |
Output is correct |
40 |
Correct |
23 ms |
36276 KB |
Output is correct |
41 |
Correct |
21 ms |
36300 KB |
Output is correct |
42 |
Correct |
23 ms |
36180 KB |
Output is correct |
43 |
Correct |
25 ms |
36552 KB |
Output is correct |
44 |
Correct |
25 ms |
36660 KB |
Output is correct |
45 |
Correct |
348 ms |
81704 KB |
Output is correct |
46 |
Correct |
528 ms |
93580 KB |
Output is correct |
47 |
Correct |
524 ms |
92304 KB |
Output is correct |
48 |
Correct |
23 ms |
36256 KB |
Output is correct |
49 |
Correct |
23 ms |
36252 KB |
Output is correct |
50 |
Correct |
24 ms |
36300 KB |
Output is correct |
51 |
Correct |
23 ms |
36224 KB |
Output is correct |
52 |
Correct |
23 ms |
36300 KB |
Output is correct |
53 |
Correct |
23 ms |
36304 KB |
Output is correct |
54 |
Correct |
22 ms |
36300 KB |
Output is correct |
55 |
Correct |
802 ms |
114092 KB |
Output is correct |
56 |
Correct |
22 ms |
36300 KB |
Output is correct |
57 |
Correct |
26 ms |
36952 KB |
Output is correct |
58 |
Correct |
39 ms |
38724 KB |
Output is correct |
59 |
Correct |
28 ms |
37312 KB |
Output is correct |
60 |
Correct |
372 ms |
75464 KB |
Output is correct |
61 |
Correct |
514 ms |
84804 KB |
Output is correct |
62 |
Correct |
646 ms |
95272 KB |
Output is correct |
63 |
Correct |
811 ms |
109644 KB |
Output is correct |
64 |
Correct |
22 ms |
36300 KB |
Output is correct |
65 |
Correct |
23 ms |
36268 KB |
Output is correct |
66 |
Correct |
23 ms |
36260 KB |
Output is correct |
67 |
Correct |
727 ms |
134748 KB |
Output is correct |
68 |
Correct |
777 ms |
131896 KB |
Output is correct |
69 |
Correct |
731 ms |
133300 KB |
Output is correct |
70 |
Correct |
29 ms |
36812 KB |
Output is correct |
71 |
Correct |
28 ms |
37140 KB |
Output is correct |
72 |
Correct |
365 ms |
77100 KB |
Output is correct |
73 |
Correct |
571 ms |
94532 KB |
Output is correct |
74 |
Correct |
796 ms |
115392 KB |
Output is correct |
75 |
Correct |
781 ms |
116668 KB |
Output is correct |
76 |
Correct |
754 ms |
147456 KB |
Output is correct |
77 |
Correct |
27 ms |
36940 KB |
Output is correct |
78 |
Correct |
30 ms |
37424 KB |
Output is correct |
79 |
Correct |
379 ms |
77344 KB |
Output is correct |
80 |
Correct |
563 ms |
98116 KB |
Output is correct |
81 |
Correct |
806 ms |
121028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
36200 KB |
Output is correct |
2 |
Correct |
22 ms |
36300 KB |
Output is correct |
3 |
Correct |
22 ms |
36252 KB |
Output is correct |
4 |
Correct |
24 ms |
36300 KB |
Output is correct |
5 |
Correct |
23 ms |
36200 KB |
Output is correct |
6 |
Correct |
21 ms |
36292 KB |
Output is correct |
7 |
Correct |
22 ms |
36300 KB |
Output is correct |
8 |
Correct |
23 ms |
36264 KB |
Output is correct |
9 |
Correct |
347 ms |
83472 KB |
Output is correct |
10 |
Correct |
51 ms |
42000 KB |
Output is correct |
11 |
Correct |
198 ms |
62848 KB |
Output is correct |
12 |
Correct |
66 ms |
44188 KB |
Output is correct |
13 |
Correct |
73 ms |
44804 KB |
Output is correct |
14 |
Correct |
24 ms |
36376 KB |
Output is correct |
15 |
Correct |
24 ms |
36540 KB |
Output is correct |
16 |
Correct |
347 ms |
84936 KB |
Output is correct |
17 |
Correct |
22 ms |
36216 KB |
Output is correct |
18 |
Correct |
23 ms |
36236 KB |
Output is correct |
19 |
Correct |
23 ms |
36256 KB |
Output is correct |
20 |
Correct |
788 ms |
113568 KB |
Output is correct |
21 |
Correct |
836 ms |
110640 KB |
Output is correct |
22 |
Correct |
836 ms |
110848 KB |
Output is correct |
23 |
Correct |
649 ms |
122588 KB |
Output is correct |
24 |
Correct |
191 ms |
53440 KB |
Output is correct |
25 |
Correct |
185 ms |
53588 KB |
Output is correct |
26 |
Correct |
190 ms |
53580 KB |
Output is correct |
27 |
Correct |
673 ms |
110008 KB |
Output is correct |
28 |
Correct |
667 ms |
110108 KB |
Output is correct |
29 |
Correct |
940 ms |
110020 KB |
Output is correct |
30 |
Correct |
941 ms |
110020 KB |
Output is correct |
31 |
Correct |
23 ms |
36228 KB |
Output is correct |
32 |
Correct |
65 ms |
41552 KB |
Output is correct |
33 |
Correct |
91 ms |
44812 KB |
Output is correct |
34 |
Correct |
809 ms |
118536 KB |
Output is correct |
35 |
Correct |
32 ms |
37196 KB |
Output is correct |
36 |
Correct |
61 ms |
40676 KB |
Output is correct |
37 |
Correct |
104 ms |
44968 KB |
Output is correct |
38 |
Correct |
303 ms |
59908 KB |
Output is correct |
39 |
Correct |
428 ms |
68548 KB |
Output is correct |
40 |
Correct |
549 ms |
77520 KB |
Output is correct |
41 |
Correct |
672 ms |
86092 KB |
Output is correct |
42 |
Correct |
805 ms |
94776 KB |
Output is correct |
43 |
Correct |
23 ms |
36300 KB |
Output is correct |
44 |
Correct |
23 ms |
36240 KB |
Output is correct |
45 |
Correct |
23 ms |
36300 KB |
Output is correct |
46 |
Correct |
24 ms |
36300 KB |
Output is correct |
47 |
Correct |
24 ms |
36256 KB |
Output is correct |
48 |
Correct |
23 ms |
36228 KB |
Output is correct |
49 |
Correct |
23 ms |
36240 KB |
Output is correct |
50 |
Correct |
23 ms |
36320 KB |
Output is correct |
51 |
Correct |
24 ms |
36204 KB |
Output is correct |
52 |
Correct |
22 ms |
36300 KB |
Output is correct |
53 |
Correct |
23 ms |
36428 KB |
Output is correct |
54 |
Correct |
24 ms |
36460 KB |
Output is correct |
55 |
Correct |
24 ms |
36628 KB |
Output is correct |
56 |
Correct |
348 ms |
78260 KB |
Output is correct |
57 |
Correct |
530 ms |
94788 KB |
Output is correct |
58 |
Correct |
532 ms |
100256 KB |
Output is correct |
59 |
Correct |
23 ms |
36300 KB |
Output is correct |
60 |
Correct |
23 ms |
36236 KB |
Output is correct |
61 |
Correct |
23 ms |
36300 KB |
Output is correct |
62 |
Correct |
753 ms |
147396 KB |
Output is correct |
63 |
Correct |
758 ms |
134944 KB |
Output is correct |
64 |
Correct |
753 ms |
145740 KB |
Output is correct |
65 |
Correct |
26 ms |
36812 KB |
Output is correct |
66 |
Correct |
29 ms |
37212 KB |
Output is correct |
67 |
Correct |
366 ms |
76336 KB |
Output is correct |
68 |
Correct |
579 ms |
91184 KB |
Output is correct |
69 |
Correct |
797 ms |
119624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
36200 KB |
Output is correct |
2 |
Correct |
22 ms |
36300 KB |
Output is correct |
3 |
Correct |
22 ms |
36252 KB |
Output is correct |
4 |
Correct |
24 ms |
36300 KB |
Output is correct |
5 |
Correct |
23 ms |
36200 KB |
Output is correct |
6 |
Correct |
21 ms |
36292 KB |
Output is correct |
7 |
Correct |
22 ms |
36300 KB |
Output is correct |
8 |
Correct |
23 ms |
36264 KB |
Output is correct |
9 |
Correct |
347 ms |
83472 KB |
Output is correct |
10 |
Correct |
51 ms |
42000 KB |
Output is correct |
11 |
Correct |
198 ms |
62848 KB |
Output is correct |
12 |
Correct |
66 ms |
44188 KB |
Output is correct |
13 |
Correct |
73 ms |
44804 KB |
Output is correct |
14 |
Correct |
24 ms |
36376 KB |
Output is correct |
15 |
Correct |
24 ms |
36540 KB |
Output is correct |
16 |
Correct |
347 ms |
84936 KB |
Output is correct |
17 |
Correct |
786 ms |
147380 KB |
Output is correct |
18 |
Correct |
776 ms |
135564 KB |
Output is correct |
19 |
Correct |
843 ms |
128632 KB |
Output is correct |
20 |
Correct |
818 ms |
102192 KB |
Output is correct |
21 |
Correct |
709 ms |
102436 KB |
Output is correct |
22 |
Correct |
23 ms |
36292 KB |
Output is correct |
23 |
Correct |
122 ms |
47216 KB |
Output is correct |
24 |
Correct |
44 ms |
38704 KB |
Output is correct |
25 |
Correct |
79 ms |
43212 KB |
Output is correct |
26 |
Correct |
123 ms |
47428 KB |
Output is correct |
27 |
Correct |
399 ms |
70964 KB |
Output is correct |
28 |
Correct |
507 ms |
79948 KB |
Output is correct |
29 |
Correct |
611 ms |
87748 KB |
Output is correct |
30 |
Correct |
736 ms |
96516 KB |
Output is correct |
31 |
Correct |
846 ms |
104300 KB |
Output is correct |
32 |
Correct |
777 ms |
118852 KB |
Output is correct |
33 |
Correct |
794 ms |
147468 KB |
Output is correct |
34 |
Correct |
27 ms |
37068 KB |
Output is correct |
35 |
Correct |
30 ms |
37552 KB |
Output is correct |
36 |
Correct |
383 ms |
77480 KB |
Output is correct |
37 |
Correct |
583 ms |
92740 KB |
Output is correct |
38 |
Correct |
784 ms |
115268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
36200 KB |
Output is correct |
2 |
Correct |
22 ms |
36300 KB |
Output is correct |
3 |
Correct |
22 ms |
36252 KB |
Output is correct |
4 |
Correct |
24 ms |
36300 KB |
Output is correct |
5 |
Correct |
23 ms |
36200 KB |
Output is correct |
6 |
Correct |
21 ms |
36292 KB |
Output is correct |
7 |
Correct |
22 ms |
36300 KB |
Output is correct |
8 |
Correct |
23 ms |
36264 KB |
Output is correct |
9 |
Correct |
347 ms |
83472 KB |
Output is correct |
10 |
Correct |
51 ms |
42000 KB |
Output is correct |
11 |
Correct |
198 ms |
62848 KB |
Output is correct |
12 |
Correct |
66 ms |
44188 KB |
Output is correct |
13 |
Correct |
73 ms |
44804 KB |
Output is correct |
14 |
Correct |
24 ms |
36376 KB |
Output is correct |
15 |
Correct |
24 ms |
36540 KB |
Output is correct |
16 |
Correct |
347 ms |
84936 KB |
Output is correct |
17 |
Correct |
23 ms |
36248 KB |
Output is correct |
18 |
Correct |
23 ms |
36292 KB |
Output is correct |
19 |
Correct |
23 ms |
36412 KB |
Output is correct |
20 |
Correct |
23 ms |
36236 KB |
Output is correct |
21 |
Correct |
21 ms |
36260 KB |
Output is correct |
22 |
Correct |
23 ms |
36248 KB |
Output is correct |
23 |
Correct |
750 ms |
115212 KB |
Output is correct |
24 |
Correct |
24 ms |
36300 KB |
Output is correct |
25 |
Correct |
26 ms |
36748 KB |
Output is correct |
26 |
Correct |
25 ms |
36736 KB |
Output is correct |
27 |
Correct |
25 ms |
36600 KB |
Output is correct |
28 |
Correct |
286 ms |
70796 KB |
Output is correct |
29 |
Correct |
432 ms |
82884 KB |
Output is correct |
30 |
Correct |
616 ms |
104516 KB |
Output is correct |
31 |
Correct |
764 ms |
116932 KB |
Output is correct |
32 |
Correct |
22 ms |
36292 KB |
Output is correct |
33 |
Correct |
23 ms |
36232 KB |
Output is correct |
34 |
Correct |
23 ms |
36204 KB |
Output is correct |
35 |
Correct |
23 ms |
36200 KB |
Output is correct |
36 |
Correct |
23 ms |
36316 KB |
Output is correct |
37 |
Correct |
22 ms |
36292 KB |
Output is correct |
38 |
Correct |
23 ms |
36300 KB |
Output is correct |
39 |
Correct |
23 ms |
36300 KB |
Output is correct |
40 |
Correct |
23 ms |
36276 KB |
Output is correct |
41 |
Correct |
21 ms |
36300 KB |
Output is correct |
42 |
Correct |
23 ms |
36180 KB |
Output is correct |
43 |
Correct |
25 ms |
36552 KB |
Output is correct |
44 |
Correct |
25 ms |
36660 KB |
Output is correct |
45 |
Correct |
348 ms |
81704 KB |
Output is correct |
46 |
Correct |
528 ms |
93580 KB |
Output is correct |
47 |
Correct |
524 ms |
92304 KB |
Output is correct |
48 |
Correct |
23 ms |
36256 KB |
Output is correct |
49 |
Correct |
23 ms |
36252 KB |
Output is correct |
50 |
Correct |
24 ms |
36300 KB |
Output is correct |
51 |
Correct |
23 ms |
36224 KB |
Output is correct |
52 |
Correct |
23 ms |
36300 KB |
Output is correct |
53 |
Correct |
23 ms |
36304 KB |
Output is correct |
54 |
Correct |
22 ms |
36300 KB |
Output is correct |
55 |
Correct |
802 ms |
114092 KB |
Output is correct |
56 |
Correct |
22 ms |
36300 KB |
Output is correct |
57 |
Correct |
26 ms |
36952 KB |
Output is correct |
58 |
Correct |
39 ms |
38724 KB |
Output is correct |
59 |
Correct |
28 ms |
37312 KB |
Output is correct |
60 |
Correct |
372 ms |
75464 KB |
Output is correct |
61 |
Correct |
514 ms |
84804 KB |
Output is correct |
62 |
Correct |
646 ms |
95272 KB |
Output is correct |
63 |
Correct |
811 ms |
109644 KB |
Output is correct |
64 |
Correct |
22 ms |
36300 KB |
Output is correct |
65 |
Correct |
23 ms |
36268 KB |
Output is correct |
66 |
Correct |
23 ms |
36260 KB |
Output is correct |
67 |
Correct |
727 ms |
134748 KB |
Output is correct |
68 |
Correct |
777 ms |
131896 KB |
Output is correct |
69 |
Correct |
731 ms |
133300 KB |
Output is correct |
70 |
Correct |
29 ms |
36812 KB |
Output is correct |
71 |
Correct |
28 ms |
37140 KB |
Output is correct |
72 |
Correct |
365 ms |
77100 KB |
Output is correct |
73 |
Correct |
571 ms |
94532 KB |
Output is correct |
74 |
Correct |
796 ms |
115392 KB |
Output is correct |
75 |
Correct |
781 ms |
116668 KB |
Output is correct |
76 |
Correct |
754 ms |
147456 KB |
Output is correct |
77 |
Correct |
27 ms |
36940 KB |
Output is correct |
78 |
Correct |
30 ms |
37424 KB |
Output is correct |
79 |
Correct |
379 ms |
77344 KB |
Output is correct |
80 |
Correct |
563 ms |
98116 KB |
Output is correct |
81 |
Correct |
806 ms |
121028 KB |
Output is correct |
82 |
Correct |
22 ms |
36216 KB |
Output is correct |
83 |
Correct |
23 ms |
36236 KB |
Output is correct |
84 |
Correct |
23 ms |
36256 KB |
Output is correct |
85 |
Correct |
788 ms |
113568 KB |
Output is correct |
86 |
Correct |
836 ms |
110640 KB |
Output is correct |
87 |
Correct |
836 ms |
110848 KB |
Output is correct |
88 |
Correct |
649 ms |
122588 KB |
Output is correct |
89 |
Correct |
191 ms |
53440 KB |
Output is correct |
90 |
Correct |
185 ms |
53588 KB |
Output is correct |
91 |
Correct |
190 ms |
53580 KB |
Output is correct |
92 |
Correct |
673 ms |
110008 KB |
Output is correct |
93 |
Correct |
667 ms |
110108 KB |
Output is correct |
94 |
Correct |
940 ms |
110020 KB |
Output is correct |
95 |
Correct |
941 ms |
110020 KB |
Output is correct |
96 |
Correct |
23 ms |
36228 KB |
Output is correct |
97 |
Correct |
65 ms |
41552 KB |
Output is correct |
98 |
Correct |
91 ms |
44812 KB |
Output is correct |
99 |
Correct |
809 ms |
118536 KB |
Output is correct |
100 |
Correct |
32 ms |
37196 KB |
Output is correct |
101 |
Correct |
61 ms |
40676 KB |
Output is correct |
102 |
Correct |
104 ms |
44968 KB |
Output is correct |
103 |
Correct |
303 ms |
59908 KB |
Output is correct |
104 |
Correct |
428 ms |
68548 KB |
Output is correct |
105 |
Correct |
549 ms |
77520 KB |
Output is correct |
106 |
Correct |
672 ms |
86092 KB |
Output is correct |
107 |
Correct |
805 ms |
94776 KB |
Output is correct |
108 |
Correct |
23 ms |
36300 KB |
Output is correct |
109 |
Correct |
23 ms |
36240 KB |
Output is correct |
110 |
Correct |
23 ms |
36300 KB |
Output is correct |
111 |
Correct |
24 ms |
36300 KB |
Output is correct |
112 |
Correct |
24 ms |
36256 KB |
Output is correct |
113 |
Correct |
23 ms |
36228 KB |
Output is correct |
114 |
Correct |
23 ms |
36240 KB |
Output is correct |
115 |
Correct |
23 ms |
36320 KB |
Output is correct |
116 |
Correct |
24 ms |
36204 KB |
Output is correct |
117 |
Correct |
22 ms |
36300 KB |
Output is correct |
118 |
Correct |
23 ms |
36428 KB |
Output is correct |
119 |
Correct |
24 ms |
36460 KB |
Output is correct |
120 |
Correct |
24 ms |
36628 KB |
Output is correct |
121 |
Correct |
348 ms |
78260 KB |
Output is correct |
122 |
Correct |
530 ms |
94788 KB |
Output is correct |
123 |
Correct |
532 ms |
100256 KB |
Output is correct |
124 |
Correct |
23 ms |
36300 KB |
Output is correct |
125 |
Correct |
23 ms |
36236 KB |
Output is correct |
126 |
Correct |
23 ms |
36300 KB |
Output is correct |
127 |
Correct |
753 ms |
147396 KB |
Output is correct |
128 |
Correct |
758 ms |
134944 KB |
Output is correct |
129 |
Correct |
753 ms |
145740 KB |
Output is correct |
130 |
Correct |
26 ms |
36812 KB |
Output is correct |
131 |
Correct |
29 ms |
37212 KB |
Output is correct |
132 |
Correct |
366 ms |
76336 KB |
Output is correct |
133 |
Correct |
579 ms |
91184 KB |
Output is correct |
134 |
Correct |
797 ms |
119624 KB |
Output is correct |
135 |
Correct |
786 ms |
147380 KB |
Output is correct |
136 |
Correct |
776 ms |
135564 KB |
Output is correct |
137 |
Correct |
843 ms |
128632 KB |
Output is correct |
138 |
Correct |
818 ms |
102192 KB |
Output is correct |
139 |
Correct |
709 ms |
102436 KB |
Output is correct |
140 |
Correct |
23 ms |
36292 KB |
Output is correct |
141 |
Correct |
122 ms |
47216 KB |
Output is correct |
142 |
Correct |
44 ms |
38704 KB |
Output is correct |
143 |
Correct |
79 ms |
43212 KB |
Output is correct |
144 |
Correct |
123 ms |
47428 KB |
Output is correct |
145 |
Correct |
399 ms |
70964 KB |
Output is correct |
146 |
Correct |
507 ms |
79948 KB |
Output is correct |
147 |
Correct |
611 ms |
87748 KB |
Output is correct |
148 |
Correct |
736 ms |
96516 KB |
Output is correct |
149 |
Correct |
846 ms |
104300 KB |
Output is correct |
150 |
Correct |
777 ms |
118852 KB |
Output is correct |
151 |
Correct |
794 ms |
147468 KB |
Output is correct |
152 |
Correct |
27 ms |
37068 KB |
Output is correct |
153 |
Correct |
30 ms |
37552 KB |
Output is correct |
154 |
Correct |
383 ms |
77480 KB |
Output is correct |
155 |
Correct |
583 ms |
92740 KB |
Output is correct |
156 |
Correct |
784 ms |
115268 KB |
Output is correct |
157 |
Correct |
23 ms |
36308 KB |
Output is correct |
158 |
Correct |
22 ms |
36300 KB |
Output is correct |
159 |
Correct |
23 ms |
36272 KB |
Output is correct |
160 |
Correct |
23 ms |
36300 KB |
Output is correct |
161 |
Execution timed out |
3566 ms |
92404 KB |
Time limit exceeded |
162 |
Halted |
0 ms |
0 KB |
- |