#include "parks.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;
const int INF = 202020;
vector<pii> lsX[INF];
vector<pii> lsY[INF];
vector<pii> eg, tr;
int par[202020];
int fnd(int x) { return x == par[x] ? x : par[x] = fnd(par[x]); }
void uni(int x, int y) { par[fnd(x)] = fnd(y); }
vector<int> U, V, A, B;
vector<int> gph[404040];
int ord[404040];
int scc[404040];
int scnt = 0, cnt = 0;
vector<int> S;
int dfs(int x, int p)
{
int ret = ord[x] = ++cnt;
S.push_back(x);
for(int y : gph[x]) if(y != p)
{
if(!ord[y]) ret = min(ret, dfs(y, x));
else if(!scc[y]) ret = min(ret, ord[y]);
}
if(ret >= ord[x])
{
++scnt;
while(S.back() != x) scc[S.back()] = scnt, S.pop_back();
scc[S.back()] = scnt, S.pop_back();
}
return ret;
}
int construct_roads(vector<int> x, vector<int> y)
{
int n = x.size();
for(int i = 0; i < n; ++i) lsX[x[i]].push_back({y[i], i});
for(int i = 0; i < n; ++i) lsY[y[i]].push_back({x[i], i});
for(int i = 0; i < INF; ++i)
{
sort(lsX[i].begin(), lsX[i].end());
for(int j = 0; j < (int)lsX[i].size() - 1; ++j)
if(lsX[i][j + 1].ff - lsX[i][j].ff == 2) eg.push_back({lsX[i][j].ss, lsX[i][j + 1].ss});
}
for(int i = 0; i < INF; ++i)
{
sort(lsY[i].begin(), lsY[i].end());
for(int j = 0; j < (int)lsY[i].size() - 1; ++j)
if(lsY[i][j + 1].ff - lsY[i][j].ff == 2) eg.push_back({lsY[i][j].ss, lsY[i][j + 1].ss});
}
for(int i = 0; i < 202020; ++i) par[i] = i;
for(auto i : eg) if(fnd(i.ff) != fnd(i.ss)) tr.push_back(i), uni(i.ff, i.ss);
if(tr.size() != n - 1) return 0;
pii C[n - 1], D[n - 1];
vector<pii> pr;
int c = 0;
for(auto [i, j] : tr)
{
if(x[i] == x[j])
{
C[c] = {x[i] - 1, y[i] + 1};
D[c] = {x[i] + 1, y[i] + 1};
}
else
{
C[c] = {x[i] + 1, y[i] - 1};
D[c] = {x[i] + 1, y[i] + 1};
}
pr.push_back(C[c]);
pr.push_back(D[c]);
++c;
}
sort(pr.begin(), pr.end());
pr.resize(unique(pr.begin(), pr.end()) - pr.begin());
int E[n - 1], F[n - 1];
for(int i = 0; i < n - 1; ++i) E[i] = lower_bound(pr.begin(), pr.end(), C[i]) - pr.begin();
for(int i = 0; i < n - 1; ++i) F[i] = lower_bound(pr.begin(), pr.end(), D[i]) - pr.begin();
int N = pr.size();
vector<pii> ls[N];
for(int i = 0; i < n - 1; ++i) ls[E[i]].push_back({i, 0});
for(int i = 0; i < n - 1; ++i) ls[F[i]].push_back({i, 1});
for(int i = 0; i < N; ++i)
{
int sz = ls[i].size();
for(int j = 0; j < sz; ++j)
{
for(int k = 0; k < sz; ++k)
{
if(j != k)
{
int p = ls[i][j].ff + ls[i][j].ss * n;
int q = ls[i][k].ff + (!ls[i][k].ss) * n;
gph[p].push_back(q);
}
}
}
}
for(int i = 0; i < 2 * n; ++i) if(!ord[i]) dfs(i, -1);
for(int i = 0; i < n - 1; ++i) if(scc[i] == scc[i + n]) return 0;
for(int i = 0; i < n - 1; ++i)
{
U.push_back(tr[i].ff);
V.push_back(tr[i].ss);
if(scc[i] < scc[i + n])
{
A.push_back(C[i].ff);
B.push_back(C[i].ss);
}
else
{
A.push_back(D[i].ff);
B.push_back(D[i].ss);
}
}
build(U, V, A, B);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:66:18: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
66 | if(tr.size() != n - 1) return 0;
| ~~~~~~~~~~^~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
20044 KB |
Output is correct |
2 |
Correct |
15 ms |
20044 KB |
Output is correct |
3 |
Correct |
19 ms |
20020 KB |
Output is correct |
4 |
Correct |
17 ms |
20068 KB |
Output is correct |
5 |
Correct |
18 ms |
20048 KB |
Output is correct |
6 |
Correct |
17 ms |
20044 KB |
Output is correct |
7 |
Correct |
16 ms |
20028 KB |
Output is correct |
8 |
Correct |
18 ms |
20056 KB |
Output is correct |
9 |
Correct |
167 ms |
48596 KB |
Output is correct |
10 |
Correct |
29 ms |
22984 KB |
Output is correct |
11 |
Correct |
84 ms |
35312 KB |
Output is correct |
12 |
Correct |
36 ms |
24292 KB |
Output is correct |
13 |
Correct |
31 ms |
23616 KB |
Output is correct |
14 |
Correct |
18 ms |
20076 KB |
Output is correct |
15 |
Correct |
17 ms |
20172 KB |
Output is correct |
16 |
Correct |
166 ms |
48640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
20044 KB |
Output is correct |
2 |
Correct |
15 ms |
20044 KB |
Output is correct |
3 |
Correct |
19 ms |
20020 KB |
Output is correct |
4 |
Correct |
17 ms |
20068 KB |
Output is correct |
5 |
Correct |
18 ms |
20048 KB |
Output is correct |
6 |
Correct |
17 ms |
20044 KB |
Output is correct |
7 |
Correct |
16 ms |
20028 KB |
Output is correct |
8 |
Correct |
18 ms |
20056 KB |
Output is correct |
9 |
Correct |
167 ms |
48596 KB |
Output is correct |
10 |
Correct |
29 ms |
22984 KB |
Output is correct |
11 |
Correct |
84 ms |
35312 KB |
Output is correct |
12 |
Correct |
36 ms |
24292 KB |
Output is correct |
13 |
Correct |
31 ms |
23616 KB |
Output is correct |
14 |
Correct |
18 ms |
20076 KB |
Output is correct |
15 |
Correct |
17 ms |
20172 KB |
Output is correct |
16 |
Correct |
166 ms |
48640 KB |
Output is correct |
17 |
Correct |
16 ms |
20016 KB |
Output is correct |
18 |
Correct |
18 ms |
20044 KB |
Output is correct |
19 |
Correct |
18 ms |
19988 KB |
Output is correct |
20 |
Correct |
16 ms |
20044 KB |
Output is correct |
21 |
Correct |
16 ms |
20044 KB |
Output is correct |
22 |
Correct |
18 ms |
19996 KB |
Output is correct |
23 |
Correct |
342 ms |
75524 KB |
Output is correct |
24 |
Correct |
17 ms |
20044 KB |
Output is correct |
25 |
Correct |
19 ms |
20428 KB |
Output is correct |
26 |
Correct |
17 ms |
20276 KB |
Output is correct |
27 |
Correct |
17 ms |
20256 KB |
Output is correct |
28 |
Correct |
137 ms |
42604 KB |
Output is correct |
29 |
Correct |
198 ms |
53040 KB |
Output is correct |
30 |
Correct |
261 ms |
65056 KB |
Output is correct |
31 |
Correct |
411 ms |
75560 KB |
Output is correct |
32 |
Correct |
17 ms |
20044 KB |
Output is correct |
33 |
Correct |
17 ms |
20044 KB |
Output is correct |
34 |
Correct |
18 ms |
20044 KB |
Output is correct |
35 |
Correct |
17 ms |
20044 KB |
Output is correct |
36 |
Correct |
19 ms |
20044 KB |
Output is correct |
37 |
Correct |
16 ms |
20048 KB |
Output is correct |
38 |
Correct |
16 ms |
20044 KB |
Output is correct |
39 |
Correct |
16 ms |
20044 KB |
Output is correct |
40 |
Correct |
17 ms |
20016 KB |
Output is correct |
41 |
Correct |
16 ms |
20028 KB |
Output is correct |
42 |
Correct |
17 ms |
20044 KB |
Output is correct |
43 |
Correct |
18 ms |
20120 KB |
Output is correct |
44 |
Correct |
19 ms |
20296 KB |
Output is correct |
45 |
Correct |
182 ms |
48120 KB |
Output is correct |
46 |
Correct |
244 ms |
61624 KB |
Output is correct |
47 |
Correct |
253 ms |
61604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
20044 KB |
Output is correct |
2 |
Correct |
15 ms |
20044 KB |
Output is correct |
3 |
Correct |
19 ms |
20020 KB |
Output is correct |
4 |
Correct |
17 ms |
20068 KB |
Output is correct |
5 |
Correct |
18 ms |
20048 KB |
Output is correct |
6 |
Correct |
17 ms |
20044 KB |
Output is correct |
7 |
Correct |
16 ms |
20028 KB |
Output is correct |
8 |
Correct |
18 ms |
20056 KB |
Output is correct |
9 |
Correct |
167 ms |
48596 KB |
Output is correct |
10 |
Correct |
29 ms |
22984 KB |
Output is correct |
11 |
Correct |
84 ms |
35312 KB |
Output is correct |
12 |
Correct |
36 ms |
24292 KB |
Output is correct |
13 |
Correct |
31 ms |
23616 KB |
Output is correct |
14 |
Correct |
18 ms |
20076 KB |
Output is correct |
15 |
Correct |
17 ms |
20172 KB |
Output is correct |
16 |
Correct |
166 ms |
48640 KB |
Output is correct |
17 |
Correct |
16 ms |
20016 KB |
Output is correct |
18 |
Correct |
18 ms |
20044 KB |
Output is correct |
19 |
Correct |
18 ms |
19988 KB |
Output is correct |
20 |
Correct |
16 ms |
20044 KB |
Output is correct |
21 |
Correct |
16 ms |
20044 KB |
Output is correct |
22 |
Correct |
18 ms |
19996 KB |
Output is correct |
23 |
Correct |
342 ms |
75524 KB |
Output is correct |
24 |
Correct |
17 ms |
20044 KB |
Output is correct |
25 |
Correct |
19 ms |
20428 KB |
Output is correct |
26 |
Correct |
17 ms |
20276 KB |
Output is correct |
27 |
Correct |
17 ms |
20256 KB |
Output is correct |
28 |
Correct |
137 ms |
42604 KB |
Output is correct |
29 |
Correct |
198 ms |
53040 KB |
Output is correct |
30 |
Correct |
261 ms |
65056 KB |
Output is correct |
31 |
Correct |
411 ms |
75560 KB |
Output is correct |
32 |
Correct |
17 ms |
20044 KB |
Output is correct |
33 |
Correct |
17 ms |
20044 KB |
Output is correct |
34 |
Correct |
18 ms |
20044 KB |
Output is correct |
35 |
Correct |
17 ms |
20044 KB |
Output is correct |
36 |
Correct |
19 ms |
20044 KB |
Output is correct |
37 |
Correct |
16 ms |
20048 KB |
Output is correct |
38 |
Correct |
16 ms |
20044 KB |
Output is correct |
39 |
Correct |
16 ms |
20044 KB |
Output is correct |
40 |
Correct |
17 ms |
20016 KB |
Output is correct |
41 |
Correct |
16 ms |
20028 KB |
Output is correct |
42 |
Correct |
17 ms |
20044 KB |
Output is correct |
43 |
Correct |
18 ms |
20120 KB |
Output is correct |
44 |
Correct |
19 ms |
20296 KB |
Output is correct |
45 |
Correct |
182 ms |
48120 KB |
Output is correct |
46 |
Correct |
244 ms |
61624 KB |
Output is correct |
47 |
Correct |
253 ms |
61604 KB |
Output is correct |
48 |
Correct |
17 ms |
20044 KB |
Output is correct |
49 |
Correct |
17 ms |
20056 KB |
Output is correct |
50 |
Correct |
20 ms |
19996 KB |
Output is correct |
51 |
Correct |
17 ms |
19988 KB |
Output is correct |
52 |
Correct |
16 ms |
20044 KB |
Output is correct |
53 |
Correct |
19 ms |
20084 KB |
Output is correct |
54 |
Correct |
19 ms |
19968 KB |
Output is correct |
55 |
Correct |
353 ms |
76384 KB |
Output is correct |
56 |
Correct |
16 ms |
19960 KB |
Output is correct |
57 |
Correct |
20 ms |
20556 KB |
Output is correct |
58 |
Correct |
26 ms |
21888 KB |
Output is correct |
59 |
Correct |
24 ms |
21012 KB |
Output is correct |
60 |
Correct |
172 ms |
48144 KB |
Output is correct |
61 |
Correct |
218 ms |
59044 KB |
Output is correct |
62 |
Correct |
271 ms |
67028 KB |
Output is correct |
63 |
Correct |
345 ms |
76372 KB |
Output is correct |
64 |
Correct |
18 ms |
20044 KB |
Output is correct |
65 |
Correct |
18 ms |
19980 KB |
Output is correct |
66 |
Correct |
17 ms |
20024 KB |
Output is correct |
67 |
Correct |
302 ms |
73960 KB |
Output is correct |
68 |
Correct |
340 ms |
73956 KB |
Output is correct |
69 |
Correct |
325 ms |
73792 KB |
Output is correct |
70 |
Correct |
19 ms |
20300 KB |
Output is correct |
71 |
Correct |
22 ms |
20556 KB |
Output is correct |
72 |
Correct |
173 ms |
47652 KB |
Output is correct |
73 |
Correct |
272 ms |
62264 KB |
Output is correct |
74 |
Correct |
377 ms |
75380 KB |
Output is correct |
75 |
Correct |
351 ms |
75052 KB |
Output is correct |
76 |
Correct |
333 ms |
73936 KB |
Output is correct |
77 |
Correct |
19 ms |
20428 KB |
Output is correct |
78 |
Correct |
22 ms |
20740 KB |
Output is correct |
79 |
Correct |
179 ms |
47612 KB |
Output is correct |
80 |
Correct |
263 ms |
62200 KB |
Output is correct |
81 |
Correct |
379 ms |
75236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
20044 KB |
Output is correct |
2 |
Correct |
15 ms |
20044 KB |
Output is correct |
3 |
Correct |
19 ms |
20020 KB |
Output is correct |
4 |
Correct |
17 ms |
20068 KB |
Output is correct |
5 |
Correct |
18 ms |
20048 KB |
Output is correct |
6 |
Correct |
17 ms |
20044 KB |
Output is correct |
7 |
Correct |
16 ms |
20028 KB |
Output is correct |
8 |
Correct |
18 ms |
20056 KB |
Output is correct |
9 |
Correct |
167 ms |
48596 KB |
Output is correct |
10 |
Correct |
29 ms |
22984 KB |
Output is correct |
11 |
Correct |
84 ms |
35312 KB |
Output is correct |
12 |
Correct |
36 ms |
24292 KB |
Output is correct |
13 |
Correct |
31 ms |
23616 KB |
Output is correct |
14 |
Correct |
18 ms |
20076 KB |
Output is correct |
15 |
Correct |
17 ms |
20172 KB |
Output is correct |
16 |
Correct |
166 ms |
48640 KB |
Output is correct |
17 |
Correct |
17 ms |
20012 KB |
Output is correct |
18 |
Correct |
18 ms |
20044 KB |
Output is correct |
19 |
Correct |
17 ms |
20044 KB |
Output is correct |
20 |
Correct |
414 ms |
77760 KB |
Output is correct |
21 |
Correct |
424 ms |
85760 KB |
Output is correct |
22 |
Correct |
450 ms |
76040 KB |
Output is correct |
23 |
Correct |
276 ms |
66400 KB |
Output is correct |
24 |
Correct |
90 ms |
27204 KB |
Output is correct |
25 |
Correct |
102 ms |
31836 KB |
Output is correct |
26 |
Correct |
94 ms |
31844 KB |
Output is correct |
27 |
Correct |
285 ms |
72988 KB |
Output is correct |
28 |
Correct |
299 ms |
72944 KB |
Output is correct |
29 |
Correct |
374 ms |
72968 KB |
Output is correct |
30 |
Correct |
401 ms |
72980 KB |
Output is correct |
31 |
Correct |
16 ms |
20044 KB |
Output is correct |
32 |
Correct |
41 ms |
24052 KB |
Output is correct |
33 |
Correct |
83 ms |
27876 KB |
Output is correct |
34 |
Correct |
480 ms |
94604 KB |
Output is correct |
35 |
Correct |
21 ms |
20684 KB |
Output is correct |
36 |
Correct |
45 ms |
23356 KB |
Output is correct |
37 |
Correct |
77 ms |
26580 KB |
Output is correct |
38 |
Correct |
184 ms |
42348 KB |
Output is correct |
39 |
Correct |
240 ms |
50560 KB |
Output is correct |
40 |
Correct |
312 ms |
60244 KB |
Output is correct |
41 |
Correct |
381 ms |
67868 KB |
Output is correct |
42 |
Correct |
446 ms |
75528 KB |
Output is correct |
43 |
Correct |
17 ms |
20044 KB |
Output is correct |
44 |
Correct |
18 ms |
20060 KB |
Output is correct |
45 |
Correct |
16 ms |
19964 KB |
Output is correct |
46 |
Correct |
16 ms |
20052 KB |
Output is correct |
47 |
Correct |
17 ms |
20044 KB |
Output is correct |
48 |
Correct |
17 ms |
20040 KB |
Output is correct |
49 |
Correct |
16 ms |
20044 KB |
Output is correct |
50 |
Correct |
16 ms |
20044 KB |
Output is correct |
51 |
Correct |
17 ms |
20060 KB |
Output is correct |
52 |
Correct |
18 ms |
20056 KB |
Output is correct |
53 |
Correct |
17 ms |
20044 KB |
Output is correct |
54 |
Correct |
18 ms |
20204 KB |
Output is correct |
55 |
Correct |
18 ms |
20300 KB |
Output is correct |
56 |
Correct |
176 ms |
48080 KB |
Output is correct |
57 |
Correct |
319 ms |
61624 KB |
Output is correct |
58 |
Correct |
262 ms |
61724 KB |
Output is correct |
59 |
Correct |
18 ms |
20044 KB |
Output is correct |
60 |
Correct |
16 ms |
20008 KB |
Output is correct |
61 |
Correct |
21 ms |
20044 KB |
Output is correct |
62 |
Correct |
323 ms |
73996 KB |
Output is correct |
63 |
Correct |
333 ms |
74080 KB |
Output is correct |
64 |
Correct |
337 ms |
73784 KB |
Output is correct |
65 |
Correct |
22 ms |
20300 KB |
Output is correct |
66 |
Correct |
21 ms |
20512 KB |
Output is correct |
67 |
Correct |
182 ms |
47636 KB |
Output is correct |
68 |
Correct |
276 ms |
62332 KB |
Output is correct |
69 |
Correct |
370 ms |
75376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
20044 KB |
Output is correct |
2 |
Correct |
15 ms |
20044 KB |
Output is correct |
3 |
Correct |
19 ms |
20020 KB |
Output is correct |
4 |
Correct |
17 ms |
20068 KB |
Output is correct |
5 |
Correct |
18 ms |
20048 KB |
Output is correct |
6 |
Correct |
17 ms |
20044 KB |
Output is correct |
7 |
Correct |
16 ms |
20028 KB |
Output is correct |
8 |
Correct |
18 ms |
20056 KB |
Output is correct |
9 |
Correct |
167 ms |
48596 KB |
Output is correct |
10 |
Correct |
29 ms |
22984 KB |
Output is correct |
11 |
Correct |
84 ms |
35312 KB |
Output is correct |
12 |
Correct |
36 ms |
24292 KB |
Output is correct |
13 |
Correct |
31 ms |
23616 KB |
Output is correct |
14 |
Correct |
18 ms |
20076 KB |
Output is correct |
15 |
Correct |
17 ms |
20172 KB |
Output is correct |
16 |
Correct |
166 ms |
48640 KB |
Output is correct |
17 |
Correct |
340 ms |
74024 KB |
Output is correct |
18 |
Correct |
334 ms |
74164 KB |
Output is correct |
19 |
Correct |
451 ms |
88956 KB |
Output is correct |
20 |
Correct |
350 ms |
73060 KB |
Output is correct |
21 |
Correct |
309 ms |
68536 KB |
Output is correct |
22 |
Correct |
19 ms |
20044 KB |
Output is correct |
23 |
Correct |
70 ms |
28752 KB |
Output is correct |
24 |
Correct |
26 ms |
21472 KB |
Output is correct |
25 |
Correct |
50 ms |
25072 KB |
Output is correct |
26 |
Correct |
71 ms |
28016 KB |
Output is correct |
27 |
Correct |
211 ms |
48004 KB |
Output is correct |
28 |
Correct |
268 ms |
54772 KB |
Output is correct |
29 |
Correct |
317 ms |
62828 KB |
Output is correct |
30 |
Correct |
384 ms |
68960 KB |
Output is correct |
31 |
Correct |
439 ms |
75628 KB |
Output is correct |
32 |
Correct |
337 ms |
75052 KB |
Output is correct |
33 |
Correct |
326 ms |
74020 KB |
Output is correct |
34 |
Correct |
19 ms |
20452 KB |
Output is correct |
35 |
Correct |
22 ms |
20692 KB |
Output is correct |
36 |
Correct |
180 ms |
47704 KB |
Output is correct |
37 |
Correct |
265 ms |
62264 KB |
Output is correct |
38 |
Correct |
382 ms |
75312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
20044 KB |
Output is correct |
2 |
Correct |
15 ms |
20044 KB |
Output is correct |
3 |
Correct |
19 ms |
20020 KB |
Output is correct |
4 |
Correct |
17 ms |
20068 KB |
Output is correct |
5 |
Correct |
18 ms |
20048 KB |
Output is correct |
6 |
Correct |
17 ms |
20044 KB |
Output is correct |
7 |
Correct |
16 ms |
20028 KB |
Output is correct |
8 |
Correct |
18 ms |
20056 KB |
Output is correct |
9 |
Correct |
167 ms |
48596 KB |
Output is correct |
10 |
Correct |
29 ms |
22984 KB |
Output is correct |
11 |
Correct |
84 ms |
35312 KB |
Output is correct |
12 |
Correct |
36 ms |
24292 KB |
Output is correct |
13 |
Correct |
31 ms |
23616 KB |
Output is correct |
14 |
Correct |
18 ms |
20076 KB |
Output is correct |
15 |
Correct |
17 ms |
20172 KB |
Output is correct |
16 |
Correct |
166 ms |
48640 KB |
Output is correct |
17 |
Correct |
16 ms |
20016 KB |
Output is correct |
18 |
Correct |
18 ms |
20044 KB |
Output is correct |
19 |
Correct |
18 ms |
19988 KB |
Output is correct |
20 |
Correct |
16 ms |
20044 KB |
Output is correct |
21 |
Correct |
16 ms |
20044 KB |
Output is correct |
22 |
Correct |
18 ms |
19996 KB |
Output is correct |
23 |
Correct |
342 ms |
75524 KB |
Output is correct |
24 |
Correct |
17 ms |
20044 KB |
Output is correct |
25 |
Correct |
19 ms |
20428 KB |
Output is correct |
26 |
Correct |
17 ms |
20276 KB |
Output is correct |
27 |
Correct |
17 ms |
20256 KB |
Output is correct |
28 |
Correct |
137 ms |
42604 KB |
Output is correct |
29 |
Correct |
198 ms |
53040 KB |
Output is correct |
30 |
Correct |
261 ms |
65056 KB |
Output is correct |
31 |
Correct |
411 ms |
75560 KB |
Output is correct |
32 |
Correct |
17 ms |
20044 KB |
Output is correct |
33 |
Correct |
17 ms |
20044 KB |
Output is correct |
34 |
Correct |
18 ms |
20044 KB |
Output is correct |
35 |
Correct |
17 ms |
20044 KB |
Output is correct |
36 |
Correct |
19 ms |
20044 KB |
Output is correct |
37 |
Correct |
16 ms |
20048 KB |
Output is correct |
38 |
Correct |
16 ms |
20044 KB |
Output is correct |
39 |
Correct |
16 ms |
20044 KB |
Output is correct |
40 |
Correct |
17 ms |
20016 KB |
Output is correct |
41 |
Correct |
16 ms |
20028 KB |
Output is correct |
42 |
Correct |
17 ms |
20044 KB |
Output is correct |
43 |
Correct |
18 ms |
20120 KB |
Output is correct |
44 |
Correct |
19 ms |
20296 KB |
Output is correct |
45 |
Correct |
182 ms |
48120 KB |
Output is correct |
46 |
Correct |
244 ms |
61624 KB |
Output is correct |
47 |
Correct |
253 ms |
61604 KB |
Output is correct |
48 |
Correct |
17 ms |
20044 KB |
Output is correct |
49 |
Correct |
17 ms |
20056 KB |
Output is correct |
50 |
Correct |
20 ms |
19996 KB |
Output is correct |
51 |
Correct |
17 ms |
19988 KB |
Output is correct |
52 |
Correct |
16 ms |
20044 KB |
Output is correct |
53 |
Correct |
19 ms |
20084 KB |
Output is correct |
54 |
Correct |
19 ms |
19968 KB |
Output is correct |
55 |
Correct |
353 ms |
76384 KB |
Output is correct |
56 |
Correct |
16 ms |
19960 KB |
Output is correct |
57 |
Correct |
20 ms |
20556 KB |
Output is correct |
58 |
Correct |
26 ms |
21888 KB |
Output is correct |
59 |
Correct |
24 ms |
21012 KB |
Output is correct |
60 |
Correct |
172 ms |
48144 KB |
Output is correct |
61 |
Correct |
218 ms |
59044 KB |
Output is correct |
62 |
Correct |
271 ms |
67028 KB |
Output is correct |
63 |
Correct |
345 ms |
76372 KB |
Output is correct |
64 |
Correct |
18 ms |
20044 KB |
Output is correct |
65 |
Correct |
18 ms |
19980 KB |
Output is correct |
66 |
Correct |
17 ms |
20024 KB |
Output is correct |
67 |
Correct |
302 ms |
73960 KB |
Output is correct |
68 |
Correct |
340 ms |
73956 KB |
Output is correct |
69 |
Correct |
325 ms |
73792 KB |
Output is correct |
70 |
Correct |
19 ms |
20300 KB |
Output is correct |
71 |
Correct |
22 ms |
20556 KB |
Output is correct |
72 |
Correct |
173 ms |
47652 KB |
Output is correct |
73 |
Correct |
272 ms |
62264 KB |
Output is correct |
74 |
Correct |
377 ms |
75380 KB |
Output is correct |
75 |
Correct |
351 ms |
75052 KB |
Output is correct |
76 |
Correct |
333 ms |
73936 KB |
Output is correct |
77 |
Correct |
19 ms |
20428 KB |
Output is correct |
78 |
Correct |
22 ms |
20740 KB |
Output is correct |
79 |
Correct |
179 ms |
47612 KB |
Output is correct |
80 |
Correct |
263 ms |
62200 KB |
Output is correct |
81 |
Correct |
379 ms |
75236 KB |
Output is correct |
82 |
Correct |
17 ms |
20012 KB |
Output is correct |
83 |
Correct |
18 ms |
20044 KB |
Output is correct |
84 |
Correct |
17 ms |
20044 KB |
Output is correct |
85 |
Correct |
414 ms |
77760 KB |
Output is correct |
86 |
Correct |
424 ms |
85760 KB |
Output is correct |
87 |
Correct |
450 ms |
76040 KB |
Output is correct |
88 |
Correct |
276 ms |
66400 KB |
Output is correct |
89 |
Correct |
90 ms |
27204 KB |
Output is correct |
90 |
Correct |
102 ms |
31836 KB |
Output is correct |
91 |
Correct |
94 ms |
31844 KB |
Output is correct |
92 |
Correct |
285 ms |
72988 KB |
Output is correct |
93 |
Correct |
299 ms |
72944 KB |
Output is correct |
94 |
Correct |
374 ms |
72968 KB |
Output is correct |
95 |
Correct |
401 ms |
72980 KB |
Output is correct |
96 |
Correct |
16 ms |
20044 KB |
Output is correct |
97 |
Correct |
41 ms |
24052 KB |
Output is correct |
98 |
Correct |
83 ms |
27876 KB |
Output is correct |
99 |
Correct |
480 ms |
94604 KB |
Output is correct |
100 |
Correct |
21 ms |
20684 KB |
Output is correct |
101 |
Correct |
45 ms |
23356 KB |
Output is correct |
102 |
Correct |
77 ms |
26580 KB |
Output is correct |
103 |
Correct |
184 ms |
42348 KB |
Output is correct |
104 |
Correct |
240 ms |
50560 KB |
Output is correct |
105 |
Correct |
312 ms |
60244 KB |
Output is correct |
106 |
Correct |
381 ms |
67868 KB |
Output is correct |
107 |
Correct |
446 ms |
75528 KB |
Output is correct |
108 |
Correct |
17 ms |
20044 KB |
Output is correct |
109 |
Correct |
18 ms |
20060 KB |
Output is correct |
110 |
Correct |
16 ms |
19964 KB |
Output is correct |
111 |
Correct |
16 ms |
20052 KB |
Output is correct |
112 |
Correct |
17 ms |
20044 KB |
Output is correct |
113 |
Correct |
17 ms |
20040 KB |
Output is correct |
114 |
Correct |
16 ms |
20044 KB |
Output is correct |
115 |
Correct |
16 ms |
20044 KB |
Output is correct |
116 |
Correct |
17 ms |
20060 KB |
Output is correct |
117 |
Correct |
18 ms |
20056 KB |
Output is correct |
118 |
Correct |
17 ms |
20044 KB |
Output is correct |
119 |
Correct |
18 ms |
20204 KB |
Output is correct |
120 |
Correct |
18 ms |
20300 KB |
Output is correct |
121 |
Correct |
176 ms |
48080 KB |
Output is correct |
122 |
Correct |
319 ms |
61624 KB |
Output is correct |
123 |
Correct |
262 ms |
61724 KB |
Output is correct |
124 |
Correct |
18 ms |
20044 KB |
Output is correct |
125 |
Correct |
16 ms |
20008 KB |
Output is correct |
126 |
Correct |
21 ms |
20044 KB |
Output is correct |
127 |
Correct |
323 ms |
73996 KB |
Output is correct |
128 |
Correct |
333 ms |
74080 KB |
Output is correct |
129 |
Correct |
337 ms |
73784 KB |
Output is correct |
130 |
Correct |
22 ms |
20300 KB |
Output is correct |
131 |
Correct |
21 ms |
20512 KB |
Output is correct |
132 |
Correct |
182 ms |
47636 KB |
Output is correct |
133 |
Correct |
276 ms |
62332 KB |
Output is correct |
134 |
Correct |
370 ms |
75376 KB |
Output is correct |
135 |
Correct |
340 ms |
74024 KB |
Output is correct |
136 |
Correct |
334 ms |
74164 KB |
Output is correct |
137 |
Correct |
451 ms |
88956 KB |
Output is correct |
138 |
Correct |
350 ms |
73060 KB |
Output is correct |
139 |
Correct |
309 ms |
68536 KB |
Output is correct |
140 |
Correct |
19 ms |
20044 KB |
Output is correct |
141 |
Correct |
70 ms |
28752 KB |
Output is correct |
142 |
Correct |
26 ms |
21472 KB |
Output is correct |
143 |
Correct |
50 ms |
25072 KB |
Output is correct |
144 |
Correct |
71 ms |
28016 KB |
Output is correct |
145 |
Correct |
211 ms |
48004 KB |
Output is correct |
146 |
Correct |
268 ms |
54772 KB |
Output is correct |
147 |
Correct |
317 ms |
62828 KB |
Output is correct |
148 |
Correct |
384 ms |
68960 KB |
Output is correct |
149 |
Correct |
439 ms |
75628 KB |
Output is correct |
150 |
Correct |
337 ms |
75052 KB |
Output is correct |
151 |
Correct |
326 ms |
74020 KB |
Output is correct |
152 |
Correct |
19 ms |
20452 KB |
Output is correct |
153 |
Correct |
22 ms |
20692 KB |
Output is correct |
154 |
Correct |
180 ms |
47704 KB |
Output is correct |
155 |
Correct |
265 ms |
62264 KB |
Output is correct |
156 |
Correct |
382 ms |
75312 KB |
Output is correct |
157 |
Correct |
20 ms |
19960 KB |
Output is correct |
158 |
Correct |
16 ms |
20044 KB |
Output is correct |
159 |
Correct |
17 ms |
20036 KB |
Output is correct |
160 |
Correct |
17 ms |
20044 KB |
Output is correct |
161 |
Correct |
318 ms |
76120 KB |
Output is correct |
162 |
Correct |
443 ms |
94556 KB |
Output is correct |
163 |
Correct |
396 ms |
88912 KB |
Output is correct |
164 |
Correct |
487 ms |
88964 KB |
Output is correct |
165 |
Correct |
382 ms |
81964 KB |
Output is correct |
166 |
Correct |
344 ms |
79544 KB |
Output is correct |
167 |
Incorrect |
77 ms |
30792 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |