#include "parks.h"
#include <bits/stdc++.h>
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
struct DSU{
vector<int> bo,ss;
void init(int x){
bo.resize(x);
ss.resize(x,1);
iota(bo.begin(),bo.end(),0);
}
int find(int x){
return bo[x]==x?x:bo[x]=find(bo[x]);
}
int merge(int x,int y){
x=find(x);
y=find(y);
if(x==y){
return 0;
}
bo[x]=y;
ss[y]+=ss[x];
return 1;
}
}dsu;
vector<int> au,av,aa,ab;
set<pair<int,int> > vis;
void ag(int a,int b,int c,int d){
au.push_back(a);
av.push_back(b);
dsu.merge(a,b);
aa.push_back(c);
ab.push_back(d);
vis.insert({c,d});
//cout << a << " " << b << " " << c << " " << d << '\n';
}
int construct_roads(vector<int> x, vector<int> y) {
vis.clear();
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
map<pair<int,int>,int> mp;
int n=x.size();
for(int i=0;i<n;i++){
mp[{x[i],y[i]}]=i;
}
dsu.init(n);
const int dx[4]={0,0,2,-2},dy[4]={2,-2,0,0};
function<void(pair<int,int>,int)> dfs=[&](pair<int,int> w,int q){
int a=0,b=0,c=0,d=0;
if(dx[q]){
a=b=dx[q]/2;
c=1;
d=-1;
}
else{
a=1;
b=-1;
c=d=dy[q]/2;
}
int e=0,f=0,g=0,h=0;
int way=2*(1-q/2);
if(mp.find({w.fs+a,w.sc+c})==mp.end()){
if(mp.find({w.fs+b,w.sc+d})==mp.end()){
return;
}
way++;
}
if(dx[way]){
e=f=dx[way]/2;
g=1;
h=-1;
}
else{
e=1;
f=-1;
g=h=dy[way]/2;
}
for(int i=w.fs,j=w.sc;;i+=dx[way],j+=dy[way]){
int sx=i+e,sy=j+g,tx=i+f,ty=j+h;
if(mp.find({sx,sy})==mp.end() || mp.find({tx,ty})==mp.end()){
if(way<2){
assert(mp.find({sx-dx[way],sy-dy[way]})!=mp.end());
assert(mp.find({tx-dx[way],ty-dy[way]})!=mp.end());
ag(mp[{sx-dx[way],sy-dy[way]}],mp[{tx-dx[way],ty-dy[way]}],i,j);
}
dfs({i,j},way);
break;
}
else{
if(vis.find({i+dx[way],j+dy[way]})!=vis.end()){
break;
}
if(way>=2){
ag(mp[{sx,sy}],mp[{tx,ty}],i+dx[way],j+dy[way]);
}
}
}
};
for(int p=0;p<n;p++){
int c=x[p]+2,d=y[p];
if(mp.find({c,d})!=mp.end()){
int a=mp[{c,d}];
if(vis.find({x[p]+1,y[p]+1})==vis.end() && !(mp.find({x[p]+2,y[p]+2})!=mp.end() && mp.find({x[p],y[p]+2})!=mp.end())){
ag(a,p,x[p]+1,y[p]+1);
dfs({x[p]+1,y[p]+1},0);
}
else if(vis.find({x[p]+1,y[p]-1})==vis.end() && !(mp.find({x[p]+2,y[p]-2})!=mp.end() && mp.find({x[p],y[p]-2})!=mp.end())){
ag(a,p,x[p]+1,y[p]-1);
dfs({x[p]+1,y[p]-1},1);
}
}
}
for(int p=0;p<n;p++){
int c=x[p],d=y[p]+2;
if(mp.find({c,d})!=mp.end()){
int a=mp[{c,d}];
if(vis.find({x[p]+1,y[p]+1})==vis.end()){
ag(a,p,x[p]+1,y[p]+1);
}
else if(vis.find({x[p]-1,y[p]+1})==vis.end()){
ag(a,p,x[p]-1,y[p]+1);
}
}
}
if(dsu.ss[dsu.find(0)]!=n){
return 0;
}
build(au,av,aa,ab);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
147 ms |
18300 KB |
Output is correct |
10 |
Correct |
10 ms |
2260 KB |
Output is correct |
11 |
Correct |
56 ms |
9924 KB |
Output is correct |
12 |
Correct |
13 ms |
3284 KB |
Output is correct |
13 |
Correct |
33 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
184 ms |
18296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
147 ms |
18300 KB |
Output is correct |
10 |
Correct |
10 ms |
2260 KB |
Output is correct |
11 |
Correct |
56 ms |
9924 KB |
Output is correct |
12 |
Correct |
13 ms |
3284 KB |
Output is correct |
13 |
Correct |
33 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
184 ms |
18296 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
491 ms |
36272 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
2 ms |
468 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
4 ms |
932 KB |
Output is correct |
28 |
Correct |
151 ms |
14976 KB |
Output is correct |
29 |
Correct |
295 ms |
22192 KB |
Output is correct |
30 |
Correct |
343 ms |
29380 KB |
Output is correct |
31 |
Correct |
482 ms |
36508 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
0 ms |
300 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
0 ms |
212 KB |
Output is correct |
39 |
Correct |
0 ms |
212 KB |
Output is correct |
40 |
Correct |
0 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
296 KB |
Output is correct |
43 |
Correct |
2 ms |
596 KB |
Output is correct |
44 |
Correct |
4 ms |
724 KB |
Output is correct |
45 |
Correct |
218 ms |
18576 KB |
Output is correct |
46 |
Correct |
358 ms |
26596 KB |
Output is correct |
47 |
Correct |
360 ms |
26728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
147 ms |
18300 KB |
Output is correct |
10 |
Correct |
10 ms |
2260 KB |
Output is correct |
11 |
Correct |
56 ms |
9924 KB |
Output is correct |
12 |
Correct |
13 ms |
3284 KB |
Output is correct |
13 |
Correct |
33 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
184 ms |
18296 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
491 ms |
36272 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
2 ms |
468 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
4 ms |
932 KB |
Output is correct |
28 |
Correct |
151 ms |
14976 KB |
Output is correct |
29 |
Correct |
295 ms |
22192 KB |
Output is correct |
30 |
Correct |
343 ms |
29380 KB |
Output is correct |
31 |
Correct |
482 ms |
36508 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
0 ms |
300 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
0 ms |
212 KB |
Output is correct |
39 |
Correct |
0 ms |
212 KB |
Output is correct |
40 |
Correct |
0 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
296 KB |
Output is correct |
43 |
Correct |
2 ms |
596 KB |
Output is correct |
44 |
Correct |
4 ms |
724 KB |
Output is correct |
45 |
Correct |
218 ms |
18576 KB |
Output is correct |
46 |
Correct |
358 ms |
26596 KB |
Output is correct |
47 |
Correct |
360 ms |
26728 KB |
Output is correct |
48 |
Correct |
0 ms |
296 KB |
Output is correct |
49 |
Correct |
0 ms |
212 KB |
Output is correct |
50 |
Correct |
0 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
212 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
0 ms |
212 KB |
Output is correct |
54 |
Correct |
0 ms |
296 KB |
Output is correct |
55 |
Correct |
565 ms |
36564 KB |
Output is correct |
56 |
Correct |
0 ms |
212 KB |
Output is correct |
57 |
Correct |
3 ms |
608 KB |
Output is correct |
58 |
Correct |
11 ms |
1520 KB |
Output is correct |
59 |
Correct |
13 ms |
1884 KB |
Output is correct |
60 |
Correct |
213 ms |
18584 KB |
Output is correct |
61 |
Correct |
326 ms |
24780 KB |
Output is correct |
62 |
Correct |
394 ms |
30284 KB |
Output is correct |
63 |
Correct |
590 ms |
36580 KB |
Output is correct |
64 |
Correct |
0 ms |
212 KB |
Output is correct |
65 |
Correct |
1 ms |
304 KB |
Output is correct |
66 |
Correct |
0 ms |
212 KB |
Output is correct |
67 |
Correct |
450 ms |
36672 KB |
Output is correct |
68 |
Correct |
406 ms |
36608 KB |
Output is correct |
69 |
Correct |
383 ms |
36384 KB |
Output is correct |
70 |
Correct |
6 ms |
852 KB |
Output is correct |
71 |
Correct |
12 ms |
1452 KB |
Output is correct |
72 |
Correct |
241 ms |
18572 KB |
Output is correct |
73 |
Correct |
413 ms |
27528 KB |
Output is correct |
74 |
Correct |
665 ms |
36508 KB |
Output is correct |
75 |
Correct |
690 ms |
40492 KB |
Output is correct |
76 |
Correct |
408 ms |
36532 KB |
Output is correct |
77 |
Correct |
7 ms |
1076 KB |
Output is correct |
78 |
Correct |
13 ms |
1748 KB |
Output is correct |
79 |
Correct |
272 ms |
19548 KB |
Output is correct |
80 |
Correct |
436 ms |
29032 KB |
Output is correct |
81 |
Correct |
638 ms |
38564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
147 ms |
18300 KB |
Output is correct |
10 |
Correct |
10 ms |
2260 KB |
Output is correct |
11 |
Correct |
56 ms |
9924 KB |
Output is correct |
12 |
Correct |
13 ms |
3284 KB |
Output is correct |
13 |
Correct |
33 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
184 ms |
18296 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
296 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
675 ms |
73140 KB |
Output is correct |
21 |
Correct |
629 ms |
52928 KB |
Output is correct |
22 |
Correct |
632 ms |
49128 KB |
Output is correct |
23 |
Correct |
409 ms |
31228 KB |
Output is correct |
24 |
Correct |
191 ms |
17672 KB |
Output is correct |
25 |
Correct |
587 ms |
30224 KB |
Output is correct |
26 |
Correct |
367 ms |
30208 KB |
Output is correct |
27 |
Correct |
431 ms |
36728 KB |
Output is correct |
28 |
Correct |
440 ms |
36544 KB |
Output is correct |
29 |
Correct |
584 ms |
36508 KB |
Output is correct |
30 |
Correct |
608 ms |
36596 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
27 ms |
3272 KB |
Output is correct |
33 |
Correct |
89 ms |
9208 KB |
Output is correct |
34 |
Correct |
616 ms |
67640 KB |
Output is correct |
35 |
Correct |
17 ms |
1940 KB |
Output is correct |
36 |
Correct |
103 ms |
7928 KB |
Output is correct |
37 |
Correct |
241 ms |
15412 KB |
Output is correct |
38 |
Correct |
196 ms |
15128 KB |
Output is correct |
39 |
Correct |
325 ms |
20468 KB |
Output is correct |
40 |
Correct |
434 ms |
25964 KB |
Output is correct |
41 |
Correct |
572 ms |
31600 KB |
Output is correct |
42 |
Correct |
730 ms |
37100 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
0 ms |
212 KB |
Output is correct |
45 |
Correct |
0 ms |
212 KB |
Output is correct |
46 |
Correct |
0 ms |
212 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
0 ms |
212 KB |
Output is correct |
49 |
Correct |
0 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
212 KB |
Output is correct |
52 |
Correct |
0 ms |
304 KB |
Output is correct |
53 |
Correct |
0 ms |
292 KB |
Output is correct |
54 |
Correct |
2 ms |
568 KB |
Output is correct |
55 |
Correct |
4 ms |
724 KB |
Output is correct |
56 |
Correct |
228 ms |
18548 KB |
Output is correct |
57 |
Correct |
367 ms |
26668 KB |
Output is correct |
58 |
Correct |
344 ms |
26600 KB |
Output is correct |
59 |
Correct |
1 ms |
212 KB |
Output is correct |
60 |
Correct |
0 ms |
212 KB |
Output is correct |
61 |
Correct |
0 ms |
212 KB |
Output is correct |
62 |
Correct |
382 ms |
36588 KB |
Output is correct |
63 |
Correct |
385 ms |
36504 KB |
Output is correct |
64 |
Correct |
432 ms |
36392 KB |
Output is correct |
65 |
Correct |
5 ms |
852 KB |
Output is correct |
66 |
Correct |
14 ms |
1464 KB |
Output is correct |
67 |
Correct |
241 ms |
18532 KB |
Output is correct |
68 |
Correct |
392 ms |
27584 KB |
Output is correct |
69 |
Correct |
608 ms |
36520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
147 ms |
18300 KB |
Output is correct |
10 |
Correct |
10 ms |
2260 KB |
Output is correct |
11 |
Correct |
56 ms |
9924 KB |
Output is correct |
12 |
Correct |
13 ms |
3284 KB |
Output is correct |
13 |
Correct |
33 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
184 ms |
18296 KB |
Output is correct |
17 |
Correct |
487 ms |
36288 KB |
Output is correct |
18 |
Correct |
422 ms |
36732 KB |
Output is correct |
19 |
Correct |
688 ms |
75496 KB |
Output is correct |
20 |
Correct |
907 ms |
41900 KB |
Output is correct |
21 |
Correct |
581 ms |
33960 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
73 ms |
6820 KB |
Output is correct |
24 |
Correct |
43 ms |
3656 KB |
Output is correct |
25 |
Correct |
181 ms |
11792 KB |
Output is correct |
26 |
Correct |
390 ms |
19744 KB |
Output is correct |
27 |
Correct |
330 ms |
20684 KB |
Output is correct |
28 |
Correct |
503 ms |
25968 KB |
Output is correct |
29 |
Correct |
557 ms |
31124 KB |
Output is correct |
30 |
Correct |
724 ms |
35796 KB |
Output is correct |
31 |
Correct |
903 ms |
41136 KB |
Output is correct |
32 |
Correct |
736 ms |
40432 KB |
Output is correct |
33 |
Correct |
422 ms |
36500 KB |
Output is correct |
34 |
Correct |
7 ms |
1016 KB |
Output is correct |
35 |
Correct |
13 ms |
1748 KB |
Output is correct |
36 |
Correct |
274 ms |
19524 KB |
Output is correct |
37 |
Correct |
427 ms |
29056 KB |
Output is correct |
38 |
Correct |
719 ms |
38556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
147 ms |
18300 KB |
Output is correct |
10 |
Correct |
10 ms |
2260 KB |
Output is correct |
11 |
Correct |
56 ms |
9924 KB |
Output is correct |
12 |
Correct |
13 ms |
3284 KB |
Output is correct |
13 |
Correct |
33 ms |
6804 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
184 ms |
18296 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
491 ms |
36272 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
2 ms |
468 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
4 ms |
932 KB |
Output is correct |
28 |
Correct |
151 ms |
14976 KB |
Output is correct |
29 |
Correct |
295 ms |
22192 KB |
Output is correct |
30 |
Correct |
343 ms |
29380 KB |
Output is correct |
31 |
Correct |
482 ms |
36508 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
0 ms |
300 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
0 ms |
212 KB |
Output is correct |
39 |
Correct |
0 ms |
212 KB |
Output is correct |
40 |
Correct |
0 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
296 KB |
Output is correct |
43 |
Correct |
2 ms |
596 KB |
Output is correct |
44 |
Correct |
4 ms |
724 KB |
Output is correct |
45 |
Correct |
218 ms |
18576 KB |
Output is correct |
46 |
Correct |
358 ms |
26596 KB |
Output is correct |
47 |
Correct |
360 ms |
26728 KB |
Output is correct |
48 |
Correct |
0 ms |
296 KB |
Output is correct |
49 |
Correct |
0 ms |
212 KB |
Output is correct |
50 |
Correct |
0 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
212 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
0 ms |
212 KB |
Output is correct |
54 |
Correct |
0 ms |
296 KB |
Output is correct |
55 |
Correct |
565 ms |
36564 KB |
Output is correct |
56 |
Correct |
0 ms |
212 KB |
Output is correct |
57 |
Correct |
3 ms |
608 KB |
Output is correct |
58 |
Correct |
11 ms |
1520 KB |
Output is correct |
59 |
Correct |
13 ms |
1884 KB |
Output is correct |
60 |
Correct |
213 ms |
18584 KB |
Output is correct |
61 |
Correct |
326 ms |
24780 KB |
Output is correct |
62 |
Correct |
394 ms |
30284 KB |
Output is correct |
63 |
Correct |
590 ms |
36580 KB |
Output is correct |
64 |
Correct |
0 ms |
212 KB |
Output is correct |
65 |
Correct |
1 ms |
304 KB |
Output is correct |
66 |
Correct |
0 ms |
212 KB |
Output is correct |
67 |
Correct |
450 ms |
36672 KB |
Output is correct |
68 |
Correct |
406 ms |
36608 KB |
Output is correct |
69 |
Correct |
383 ms |
36384 KB |
Output is correct |
70 |
Correct |
6 ms |
852 KB |
Output is correct |
71 |
Correct |
12 ms |
1452 KB |
Output is correct |
72 |
Correct |
241 ms |
18572 KB |
Output is correct |
73 |
Correct |
413 ms |
27528 KB |
Output is correct |
74 |
Correct |
665 ms |
36508 KB |
Output is correct |
75 |
Correct |
690 ms |
40492 KB |
Output is correct |
76 |
Correct |
408 ms |
36532 KB |
Output is correct |
77 |
Correct |
7 ms |
1076 KB |
Output is correct |
78 |
Correct |
13 ms |
1748 KB |
Output is correct |
79 |
Correct |
272 ms |
19548 KB |
Output is correct |
80 |
Correct |
436 ms |
29032 KB |
Output is correct |
81 |
Correct |
638 ms |
38564 KB |
Output is correct |
82 |
Correct |
1 ms |
212 KB |
Output is correct |
83 |
Correct |
1 ms |
296 KB |
Output is correct |
84 |
Correct |
0 ms |
212 KB |
Output is correct |
85 |
Correct |
675 ms |
73140 KB |
Output is correct |
86 |
Correct |
629 ms |
52928 KB |
Output is correct |
87 |
Correct |
632 ms |
49128 KB |
Output is correct |
88 |
Correct |
409 ms |
31228 KB |
Output is correct |
89 |
Correct |
191 ms |
17672 KB |
Output is correct |
90 |
Correct |
587 ms |
30224 KB |
Output is correct |
91 |
Correct |
367 ms |
30208 KB |
Output is correct |
92 |
Correct |
431 ms |
36728 KB |
Output is correct |
93 |
Correct |
440 ms |
36544 KB |
Output is correct |
94 |
Correct |
584 ms |
36508 KB |
Output is correct |
95 |
Correct |
608 ms |
36596 KB |
Output is correct |
96 |
Correct |
0 ms |
212 KB |
Output is correct |
97 |
Correct |
27 ms |
3272 KB |
Output is correct |
98 |
Correct |
89 ms |
9208 KB |
Output is correct |
99 |
Correct |
616 ms |
67640 KB |
Output is correct |
100 |
Correct |
17 ms |
1940 KB |
Output is correct |
101 |
Correct |
103 ms |
7928 KB |
Output is correct |
102 |
Correct |
241 ms |
15412 KB |
Output is correct |
103 |
Correct |
196 ms |
15128 KB |
Output is correct |
104 |
Correct |
325 ms |
20468 KB |
Output is correct |
105 |
Correct |
434 ms |
25964 KB |
Output is correct |
106 |
Correct |
572 ms |
31600 KB |
Output is correct |
107 |
Correct |
730 ms |
37100 KB |
Output is correct |
108 |
Correct |
1 ms |
212 KB |
Output is correct |
109 |
Correct |
0 ms |
212 KB |
Output is correct |
110 |
Correct |
0 ms |
212 KB |
Output is correct |
111 |
Correct |
0 ms |
212 KB |
Output is correct |
112 |
Correct |
1 ms |
212 KB |
Output is correct |
113 |
Correct |
0 ms |
212 KB |
Output is correct |
114 |
Correct |
0 ms |
212 KB |
Output is correct |
115 |
Correct |
1 ms |
212 KB |
Output is correct |
116 |
Correct |
1 ms |
212 KB |
Output is correct |
117 |
Correct |
0 ms |
304 KB |
Output is correct |
118 |
Correct |
0 ms |
292 KB |
Output is correct |
119 |
Correct |
2 ms |
568 KB |
Output is correct |
120 |
Correct |
4 ms |
724 KB |
Output is correct |
121 |
Correct |
228 ms |
18548 KB |
Output is correct |
122 |
Correct |
367 ms |
26668 KB |
Output is correct |
123 |
Correct |
344 ms |
26600 KB |
Output is correct |
124 |
Correct |
1 ms |
212 KB |
Output is correct |
125 |
Correct |
0 ms |
212 KB |
Output is correct |
126 |
Correct |
0 ms |
212 KB |
Output is correct |
127 |
Correct |
382 ms |
36588 KB |
Output is correct |
128 |
Correct |
385 ms |
36504 KB |
Output is correct |
129 |
Correct |
432 ms |
36392 KB |
Output is correct |
130 |
Correct |
5 ms |
852 KB |
Output is correct |
131 |
Correct |
14 ms |
1464 KB |
Output is correct |
132 |
Correct |
241 ms |
18532 KB |
Output is correct |
133 |
Correct |
392 ms |
27584 KB |
Output is correct |
134 |
Correct |
608 ms |
36520 KB |
Output is correct |
135 |
Correct |
487 ms |
36288 KB |
Output is correct |
136 |
Correct |
422 ms |
36732 KB |
Output is correct |
137 |
Correct |
688 ms |
75496 KB |
Output is correct |
138 |
Correct |
907 ms |
41900 KB |
Output is correct |
139 |
Correct |
581 ms |
33960 KB |
Output is correct |
140 |
Correct |
1 ms |
212 KB |
Output is correct |
141 |
Correct |
73 ms |
6820 KB |
Output is correct |
142 |
Correct |
43 ms |
3656 KB |
Output is correct |
143 |
Correct |
181 ms |
11792 KB |
Output is correct |
144 |
Correct |
390 ms |
19744 KB |
Output is correct |
145 |
Correct |
330 ms |
20684 KB |
Output is correct |
146 |
Correct |
503 ms |
25968 KB |
Output is correct |
147 |
Correct |
557 ms |
31124 KB |
Output is correct |
148 |
Correct |
724 ms |
35796 KB |
Output is correct |
149 |
Correct |
903 ms |
41136 KB |
Output is correct |
150 |
Correct |
736 ms |
40432 KB |
Output is correct |
151 |
Correct |
422 ms |
36500 KB |
Output is correct |
152 |
Correct |
7 ms |
1016 KB |
Output is correct |
153 |
Correct |
13 ms |
1748 KB |
Output is correct |
154 |
Correct |
274 ms |
19524 KB |
Output is correct |
155 |
Correct |
427 ms |
29056 KB |
Output is correct |
156 |
Correct |
719 ms |
38556 KB |
Output is correct |
157 |
Correct |
1 ms |
212 KB |
Output is correct |
158 |
Correct |
1 ms |
304 KB |
Output is correct |
159 |
Correct |
0 ms |
212 KB |
Output is correct |
160 |
Correct |
1 ms |
212 KB |
Output is correct |
161 |
Correct |
718 ms |
36564 KB |
Output is correct |
162 |
Correct |
635 ms |
72088 KB |
Output is correct |
163 |
Incorrect |
738 ms |
37996 KB |
Solution announced impossible, but it is possible. |
164 |
Halted |
0 ms |
0 KB |
- |