#include "parks.h"
#include <map>
#include <utility>
#include <queue>
#include <set>
using namespace std;
map < pair < int , int > , int > all,con;
map < pair < int , int > , pair < int , int > > road;
vector < int > u,v,a,b;
queue < pair < int , int > > BFS;
set < pair < int , int > > still,Not,have;
int Father[200005];
int Find(int here)
{
if(Father[here]==here) return here;
Father[here]=Find(Father[here]);
return Father[here];
}
int construct_roads(vector < int > x, vector < int > y)
{
int N=x.size(),M,i,t,aa,bb,ok=1,xx,yy,big=0;
for(i=0;i<N;i++)
{
all[make_pair(x[i],y[i])]=i;
Father[i]=i;
big=max(big,x[i]);
}
if(big<=6)
{
for(i=0;i<N;i++)
{
if(all.find(make_pair(x[i],y[i]+2))!=all.end())
{
t=all[make_pair(x[i],y[i]+2)];
aa=Find(i);
bb=Find(t);
if(aa!=bb) Father[aa]=bb;
if(x[i]==2)
{
u.push_back(i);
v.push_back(t);
a.push_back(x[i]-1);
b.push_back(y[i]+1);
}
else if(x[i]==4)
{
if(y[i]%4==0)
{
u.push_back(i);
v.push_back(t);
a.push_back(x[i]-1);
b.push_back(y[i]+1);
}
else
{
u.push_back(i);
v.push_back(t);
a.push_back(x[i]+1);
b.push_back(y[i]+1);
}
}
else if(x[i]==6)
{
u.push_back(i);
v.push_back(t);
a.push_back(x[i]+1);
b.push_back(y[i]+1);
}
}
if(all.find(make_pair(x[i]+2,y[i]))!=all.end())
{
t=all[make_pair(x[i]+2,y[i])];
aa=Find(i);
bb=Find(t);
if(aa!=bb) Father[aa]=bb;
if(y[i]%4==0)
{
if(x[i]==2)
{
u.push_back(i);
v.push_back(t);
a.push_back(x[i]+1);
b.push_back(y[i]-1);
}
else
{
u.push_back(i);
v.push_back(t);
a.push_back(x[i]+1);
b.push_back(y[i]+1);
}
}
else
{
Not.insert(make_pair(i,t));
}
}
}
M=a.size();
for(i=0;i<M;i++) have.insert(make_pair(a[i],b[i]));
for(auto i:Not)
{
if(have.find(make_pair(x[i.first]+1,y[i.first]+1))==have.end())
{
have.insert(make_pair(x[i.first]+1,y[i.first]+1));
u.push_back(i.first);
v.push_back(i.second);
a.push_back(x[i.first]+1);
b.push_back(y[i.first]+1);
}
else if(have.find(make_pair(x[i.first]+1,y[i.first]-1))==have.end())
{
have.insert(make_pair(x[i.first]+1,y[i.first]-1));
u.push_back(i.first);
v.push_back(i.second);
a.push_back(x[i.first]+1);
b.push_back(y[i.first]-1);
}
}
t=Find(0);
for(i=0;i<N;i++)
{
if(t!=Find(i)) ok=0;
}
if(ok==0) return ok;
if(ok) build(u,v,a,b);
return ok;
}
else
{
for(i=0;i<N;i++)
{
if(all.find(make_pair(x[i],y[i]+2))!=all.end())
{
t=all[make_pair(x[i],y[i]+2)];
road[make_pair(x[i],y[i]+1)]=make_pair(i,t);
con[make_pair(x[i]+1,y[i]+1)]++;
con[make_pair(x[i]-1,y[i]+1)]++;
aa=Find(i);
bb=Find(t);
if(aa!=bb) Father[aa]=bb;
}
if(all.find(make_pair(x[i]+2,y[i]))!=all.end())
{
t=all[make_pair(x[i]+2,y[i])];
road[make_pair(x[i]+1,y[i])]=make_pair(i,t);
con[make_pair(x[i]+1,y[i]+1)]++;
con[make_pair(x[i]+1,y[i]-1)]++;
aa=Find(i);
bb=Find(t);
if(aa!=bb) Father[aa]=bb;
}
}
t=Find(0);
for(i=0;i<N;i++) if(t!=Find(i)) ok=0;
if(ok==0) return ok;
for(auto i:con)
{
still.insert(i.first);
if(i.second==1) BFS.push(i.first);
}
while(!BFS.empty())
{
xx=BFS.front().first;
yy=BFS.front().second;
BFS.pop();
still.erase(make_pair(xx,yy));
if(con[make_pair(xx,yy)]<=0) continue;
if(road.find(make_pair(xx+1,yy))!=road.end()) aa=xx+1,bb=yy;
if(road.find(make_pair(xx-1,yy))!=road.end()) aa=xx-1,bb=yy;
if(road.find(make_pair(xx,yy+1))!=road.end()) aa=xx,bb=yy+1;
if(road.find(make_pair(xx,yy-1))!=road.end()) aa=xx,bb=yy-1;
u.push_back(road[make_pair(aa,bb)].first);
v.push_back(road[make_pair(aa,bb)].second);
a.push_back(xx);
b.push_back(yy);
road.erase(make_pair(aa,bb));
con[make_pair(xx,yy)]=0;
if(aa%2==0)
{
con[make_pair(aa-1,bb)]--;
con[make_pair(aa+1,bb)]--;
if(con[make_pair(aa-1,bb)]==1) BFS.push(make_pair(aa-1,bb));
if(con[make_pair(aa+1,bb)]==1) BFS.push(make_pair(aa+1,bb));
}
else
{
con[make_pair(aa,bb-1)]--;
con[make_pair(aa,bb+1)]--;
if(con[make_pair(aa,bb-1)]==1) BFS.push(make_pair(aa,bb-1));
if(con[make_pair(aa,bb+1)]==1) BFS.push(make_pair(aa,bb+1));
}
}
while(!still.empty())
{
BFS.push(*still.begin());
while(!BFS.empty())
{
ok=0;
xx=BFS.front().first;
yy=BFS.front().second;
BFS.pop();
still.erase(make_pair(xx,yy));
if(con[make_pair(xx,yy)]<=0) continue;
if(road.find(make_pair(xx+1,yy))!=road.end()) aa=xx+1,bb=yy,ok=1;
if(road.find(make_pair(xx-1,yy))!=road.end()) aa=xx-1,bb=yy,ok=1;
if(road.find(make_pair(xx,yy+1))!=road.end()) aa=xx,bb=yy+1,ok=1;
if(road.find(make_pair(xx,yy-1))!=road.end()) aa=xx,bb=yy-1,ok=1;
con[make_pair(xx,yy)]=0;
if(ok==0) continue;
u.push_back(road[make_pair(aa,bb)].first);
v.push_back(road[make_pair(aa,bb)].second);
a.push_back(xx);
b.push_back(yy);
road.erase(make_pair(aa,bb));
if(aa%2==0)
{
con[make_pair(aa-1,bb)]--;
con[make_pair(aa+1,bb)]--;
if(con[make_pair(aa-1,bb)]==1) BFS.push(make_pair(aa-1,bb));
if(con[make_pair(aa+1,bb)]==1) BFS.push(make_pair(aa+1,bb));
}
else
{
con[make_pair(aa,bb-1)]--;
con[make_pair(aa,bb+1)]--;
if(con[make_pair(aa,bb-1)]==1) BFS.push(make_pair(aa,bb-1));
if(con[make_pair(aa,bb+1)]==1) BFS.push(make_pair(aa,bb+1));
}
}
}
if(!road.empty()) return 0;
if(ok) build(u,v,a,b);
return ok;
}
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:193:74: warning: 'bb' may be used uninitialized in this function [-Wmaybe-uninitialized]
193 | if(con[make_pair(aa+1,bb)]==1) BFS.push(make_pair(aa+1,bb));
| ^
parks.cpp:197:38: warning: 'aa' may be used uninitialized in this function [-Wmaybe-uninitialized]
197 | con[make_pair(aa,bb-1)]--;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
197 ms |
17848 KB |
Output is correct |
10 |
Correct |
12 ms |
2252 KB |
Output is correct |
11 |
Correct |
69 ms |
10424 KB |
Output is correct |
12 |
Correct |
18 ms |
3384 KB |
Output is correct |
13 |
Correct |
43 ms |
7008 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
187 ms |
17896 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
197 ms |
17848 KB |
Output is correct |
10 |
Correct |
12 ms |
2252 KB |
Output is correct |
11 |
Correct |
69 ms |
10424 KB |
Output is correct |
12 |
Correct |
18 ms |
3384 KB |
Output is correct |
13 |
Correct |
43 ms |
7008 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
187 ms |
17896 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
676 ms |
42640 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
2 ms |
460 KB |
Output is correct |
26 |
Correct |
4 ms |
716 KB |
Output is correct |
27 |
Correct |
6 ms |
972 KB |
Output is correct |
28 |
Correct |
228 ms |
17092 KB |
Output is correct |
29 |
Correct |
318 ms |
25636 KB |
Output is correct |
30 |
Correct |
463 ms |
34068 KB |
Output is correct |
31 |
Correct |
672 ms |
42540 KB |
Output is correct |
32 |
Correct |
0 ms |
204 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
0 ms |
204 KB |
Output is correct |
37 |
Correct |
0 ms |
204 KB |
Output is correct |
38 |
Correct |
0 ms |
204 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
2 ms |
588 KB |
Output is correct |
44 |
Correct |
3 ms |
728 KB |
Output is correct |
45 |
Correct |
218 ms |
18580 KB |
Output is correct |
46 |
Correct |
363 ms |
26856 KB |
Output is correct |
47 |
Correct |
358 ms |
26980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
197 ms |
17848 KB |
Output is correct |
10 |
Correct |
12 ms |
2252 KB |
Output is correct |
11 |
Correct |
69 ms |
10424 KB |
Output is correct |
12 |
Correct |
18 ms |
3384 KB |
Output is correct |
13 |
Correct |
43 ms |
7008 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
187 ms |
17896 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
676 ms |
42640 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
2 ms |
460 KB |
Output is correct |
26 |
Correct |
4 ms |
716 KB |
Output is correct |
27 |
Correct |
6 ms |
972 KB |
Output is correct |
28 |
Correct |
228 ms |
17092 KB |
Output is correct |
29 |
Correct |
318 ms |
25636 KB |
Output is correct |
30 |
Correct |
463 ms |
34068 KB |
Output is correct |
31 |
Correct |
672 ms |
42540 KB |
Output is correct |
32 |
Correct |
0 ms |
204 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
0 ms |
204 KB |
Output is correct |
37 |
Correct |
0 ms |
204 KB |
Output is correct |
38 |
Correct |
0 ms |
204 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
2 ms |
588 KB |
Output is correct |
44 |
Correct |
3 ms |
728 KB |
Output is correct |
45 |
Correct |
218 ms |
18580 KB |
Output is correct |
46 |
Correct |
363 ms |
26856 KB |
Output is correct |
47 |
Correct |
358 ms |
26980 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
0 ms |
204 KB |
Output is correct |
51 |
Correct |
0 ms |
204 KB |
Output is correct |
52 |
Correct |
0 ms |
216 KB |
Output is correct |
53 |
Correct |
0 ms |
204 KB |
Output is correct |
54 |
Correct |
0 ms |
204 KB |
Output is correct |
55 |
Correct |
793 ms |
44936 KB |
Output is correct |
56 |
Correct |
0 ms |
204 KB |
Output is correct |
57 |
Correct |
4 ms |
716 KB |
Output is correct |
58 |
Correct |
16 ms |
1684 KB |
Output is correct |
59 |
Correct |
20 ms |
2188 KB |
Output is correct |
60 |
Correct |
323 ms |
22648 KB |
Output is correct |
61 |
Correct |
467 ms |
30428 KB |
Output is correct |
62 |
Correct |
693 ms |
37344 KB |
Output is correct |
63 |
Correct |
845 ms |
44924 KB |
Output is correct |
64 |
Correct |
0 ms |
204 KB |
Output is correct |
65 |
Correct |
0 ms |
204 KB |
Output is correct |
66 |
Correct |
0 ms |
204 KB |
Output is correct |
67 |
Correct |
487 ms |
35468 KB |
Output is correct |
68 |
Correct |
480 ms |
35484 KB |
Output is correct |
69 |
Correct |
471 ms |
35432 KB |
Output is correct |
70 |
Correct |
5 ms |
844 KB |
Output is correct |
71 |
Correct |
10 ms |
1484 KB |
Output is correct |
72 |
Correct |
255 ms |
18692 KB |
Output is correct |
73 |
Correct |
385 ms |
28032 KB |
Output is correct |
74 |
Correct |
558 ms |
37184 KB |
Output is correct |
75 |
Correct |
652 ms |
43184 KB |
Output is correct |
76 |
Correct |
476 ms |
35472 KB |
Output is correct |
77 |
Correct |
6 ms |
1100 KB |
Output is correct |
78 |
Correct |
12 ms |
1856 KB |
Output is correct |
79 |
Correct |
260 ms |
19832 KB |
Output is correct |
80 |
Correct |
407 ms |
29608 KB |
Output is correct |
81 |
Correct |
638 ms |
39324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
197 ms |
17848 KB |
Output is correct |
10 |
Correct |
12 ms |
2252 KB |
Output is correct |
11 |
Correct |
69 ms |
10424 KB |
Output is correct |
12 |
Correct |
18 ms |
3384 KB |
Output is correct |
13 |
Correct |
43 ms |
7008 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
187 ms |
17896 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1151 ms |
58628 KB |
Output is correct |
21 |
Correct |
1177 ms |
57712 KB |
Output is correct |
22 |
Correct |
1122 ms |
58636 KB |
Output is correct |
23 |
Correct |
1065 ms |
69052 KB |
Output is correct |
24 |
Correct |
318 ms |
16824 KB |
Output is correct |
25 |
Correct |
958 ms |
54184 KB |
Output is correct |
26 |
Correct |
833 ms |
54180 KB |
Output is correct |
27 |
Correct |
1271 ms |
82912 KB |
Output is correct |
28 |
Correct |
1240 ms |
83060 KB |
Output is correct |
29 |
Correct |
1346 ms |
82924 KB |
Output is correct |
30 |
Correct |
1304 ms |
83716 KB |
Output is correct |
31 |
Correct |
0 ms |
204 KB |
Output is correct |
32 |
Correct |
62 ms |
5040 KB |
Output is correct |
33 |
Correct |
111 ms |
8420 KB |
Output is correct |
34 |
Correct |
1157 ms |
57940 KB |
Output is correct |
35 |
Correct |
19 ms |
2372 KB |
Output is correct |
36 |
Correct |
144 ms |
11220 KB |
Output is correct |
37 |
Correct |
389 ms |
22112 KB |
Output is correct |
38 |
Correct |
522 ms |
25536 KB |
Output is correct |
39 |
Correct |
757 ms |
34748 KB |
Output is correct |
40 |
Correct |
1038 ms |
43620 KB |
Output is correct |
41 |
Correct |
1301 ms |
53764 KB |
Output is correct |
42 |
Correct |
1562 ms |
64584 KB |
Output is correct |
43 |
Correct |
0 ms |
204 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
204 KB |
Output is correct |
46 |
Correct |
0 ms |
204 KB |
Output is correct |
47 |
Correct |
0 ms |
204 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
0 ms |
204 KB |
Output is correct |
50 |
Correct |
0 ms |
204 KB |
Output is correct |
51 |
Correct |
0 ms |
204 KB |
Output is correct |
52 |
Correct |
0 ms |
204 KB |
Output is correct |
53 |
Correct |
0 ms |
204 KB |
Output is correct |
54 |
Correct |
2 ms |
588 KB |
Output is correct |
55 |
Correct |
4 ms |
716 KB |
Output is correct |
56 |
Correct |
229 ms |
18620 KB |
Output is correct |
57 |
Correct |
359 ms |
26860 KB |
Output is correct |
58 |
Correct |
363 ms |
26908 KB |
Output is correct |
59 |
Correct |
0 ms |
204 KB |
Output is correct |
60 |
Correct |
0 ms |
204 KB |
Output is correct |
61 |
Correct |
0 ms |
204 KB |
Output is correct |
62 |
Correct |
488 ms |
35524 KB |
Output is correct |
63 |
Correct |
513 ms |
35540 KB |
Output is correct |
64 |
Correct |
555 ms |
35260 KB |
Output is correct |
65 |
Correct |
5 ms |
784 KB |
Output is correct |
66 |
Correct |
10 ms |
1484 KB |
Output is correct |
67 |
Correct |
233 ms |
18680 KB |
Output is correct |
68 |
Correct |
446 ms |
27844 KB |
Output is correct |
69 |
Correct |
649 ms |
37144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
197 ms |
17848 KB |
Output is correct |
10 |
Correct |
12 ms |
2252 KB |
Output is correct |
11 |
Correct |
69 ms |
10424 KB |
Output is correct |
12 |
Correct |
18 ms |
3384 KB |
Output is correct |
13 |
Correct |
43 ms |
7008 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
187 ms |
17896 KB |
Output is correct |
17 |
Correct |
1264 ms |
82716 KB |
Output is correct |
18 |
Correct |
1350 ms |
82000 KB |
Output is correct |
19 |
Correct |
1352 ms |
60168 KB |
Output is correct |
20 |
Correct |
1923 ms |
71556 KB |
Output is correct |
21 |
Correct |
1370 ms |
70368 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
178 ms |
10812 KB |
Output is correct |
24 |
Correct |
47 ms |
5024 KB |
Output is correct |
25 |
Correct |
275 ms |
16880 KB |
Output is correct |
26 |
Correct |
579 ms |
28928 KB |
Output is correct |
27 |
Correct |
806 ms |
34648 KB |
Output is correct |
28 |
Correct |
1229 ms |
43596 KB |
Output is correct |
29 |
Correct |
1449 ms |
52828 KB |
Output is correct |
30 |
Correct |
1598 ms |
61244 KB |
Output is correct |
31 |
Correct |
2045 ms |
69256 KB |
Output is correct |
32 |
Correct |
662 ms |
43004 KB |
Output is correct |
33 |
Correct |
508 ms |
35508 KB |
Output is correct |
34 |
Correct |
6 ms |
1100 KB |
Output is correct |
35 |
Correct |
13 ms |
1772 KB |
Output is correct |
36 |
Correct |
279 ms |
19692 KB |
Output is correct |
37 |
Correct |
501 ms |
29616 KB |
Output is correct |
38 |
Correct |
660 ms |
39300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
197 ms |
17848 KB |
Output is correct |
10 |
Correct |
12 ms |
2252 KB |
Output is correct |
11 |
Correct |
69 ms |
10424 KB |
Output is correct |
12 |
Correct |
18 ms |
3384 KB |
Output is correct |
13 |
Correct |
43 ms |
7008 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
187 ms |
17896 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
676 ms |
42640 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
2 ms |
460 KB |
Output is correct |
26 |
Correct |
4 ms |
716 KB |
Output is correct |
27 |
Correct |
6 ms |
972 KB |
Output is correct |
28 |
Correct |
228 ms |
17092 KB |
Output is correct |
29 |
Correct |
318 ms |
25636 KB |
Output is correct |
30 |
Correct |
463 ms |
34068 KB |
Output is correct |
31 |
Correct |
672 ms |
42540 KB |
Output is correct |
32 |
Correct |
0 ms |
204 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
0 ms |
204 KB |
Output is correct |
37 |
Correct |
0 ms |
204 KB |
Output is correct |
38 |
Correct |
0 ms |
204 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
2 ms |
588 KB |
Output is correct |
44 |
Correct |
3 ms |
728 KB |
Output is correct |
45 |
Correct |
218 ms |
18580 KB |
Output is correct |
46 |
Correct |
363 ms |
26856 KB |
Output is correct |
47 |
Correct |
358 ms |
26980 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
0 ms |
204 KB |
Output is correct |
51 |
Correct |
0 ms |
204 KB |
Output is correct |
52 |
Correct |
0 ms |
216 KB |
Output is correct |
53 |
Correct |
0 ms |
204 KB |
Output is correct |
54 |
Correct |
0 ms |
204 KB |
Output is correct |
55 |
Correct |
793 ms |
44936 KB |
Output is correct |
56 |
Correct |
0 ms |
204 KB |
Output is correct |
57 |
Correct |
4 ms |
716 KB |
Output is correct |
58 |
Correct |
16 ms |
1684 KB |
Output is correct |
59 |
Correct |
20 ms |
2188 KB |
Output is correct |
60 |
Correct |
323 ms |
22648 KB |
Output is correct |
61 |
Correct |
467 ms |
30428 KB |
Output is correct |
62 |
Correct |
693 ms |
37344 KB |
Output is correct |
63 |
Correct |
845 ms |
44924 KB |
Output is correct |
64 |
Correct |
0 ms |
204 KB |
Output is correct |
65 |
Correct |
0 ms |
204 KB |
Output is correct |
66 |
Correct |
0 ms |
204 KB |
Output is correct |
67 |
Correct |
487 ms |
35468 KB |
Output is correct |
68 |
Correct |
480 ms |
35484 KB |
Output is correct |
69 |
Correct |
471 ms |
35432 KB |
Output is correct |
70 |
Correct |
5 ms |
844 KB |
Output is correct |
71 |
Correct |
10 ms |
1484 KB |
Output is correct |
72 |
Correct |
255 ms |
18692 KB |
Output is correct |
73 |
Correct |
385 ms |
28032 KB |
Output is correct |
74 |
Correct |
558 ms |
37184 KB |
Output is correct |
75 |
Correct |
652 ms |
43184 KB |
Output is correct |
76 |
Correct |
476 ms |
35472 KB |
Output is correct |
77 |
Correct |
6 ms |
1100 KB |
Output is correct |
78 |
Correct |
12 ms |
1856 KB |
Output is correct |
79 |
Correct |
260 ms |
19832 KB |
Output is correct |
80 |
Correct |
407 ms |
29608 KB |
Output is correct |
81 |
Correct |
638 ms |
39324 KB |
Output is correct |
82 |
Correct |
0 ms |
204 KB |
Output is correct |
83 |
Correct |
0 ms |
204 KB |
Output is correct |
84 |
Correct |
0 ms |
204 KB |
Output is correct |
85 |
Correct |
1151 ms |
58628 KB |
Output is correct |
86 |
Correct |
1177 ms |
57712 KB |
Output is correct |
87 |
Correct |
1122 ms |
58636 KB |
Output is correct |
88 |
Correct |
1065 ms |
69052 KB |
Output is correct |
89 |
Correct |
318 ms |
16824 KB |
Output is correct |
90 |
Correct |
958 ms |
54184 KB |
Output is correct |
91 |
Correct |
833 ms |
54180 KB |
Output is correct |
92 |
Correct |
1271 ms |
82912 KB |
Output is correct |
93 |
Correct |
1240 ms |
83060 KB |
Output is correct |
94 |
Correct |
1346 ms |
82924 KB |
Output is correct |
95 |
Correct |
1304 ms |
83716 KB |
Output is correct |
96 |
Correct |
0 ms |
204 KB |
Output is correct |
97 |
Correct |
62 ms |
5040 KB |
Output is correct |
98 |
Correct |
111 ms |
8420 KB |
Output is correct |
99 |
Correct |
1157 ms |
57940 KB |
Output is correct |
100 |
Correct |
19 ms |
2372 KB |
Output is correct |
101 |
Correct |
144 ms |
11220 KB |
Output is correct |
102 |
Correct |
389 ms |
22112 KB |
Output is correct |
103 |
Correct |
522 ms |
25536 KB |
Output is correct |
104 |
Correct |
757 ms |
34748 KB |
Output is correct |
105 |
Correct |
1038 ms |
43620 KB |
Output is correct |
106 |
Correct |
1301 ms |
53764 KB |
Output is correct |
107 |
Correct |
1562 ms |
64584 KB |
Output is correct |
108 |
Correct |
0 ms |
204 KB |
Output is correct |
109 |
Correct |
0 ms |
204 KB |
Output is correct |
110 |
Correct |
1 ms |
204 KB |
Output is correct |
111 |
Correct |
0 ms |
204 KB |
Output is correct |
112 |
Correct |
0 ms |
204 KB |
Output is correct |
113 |
Correct |
0 ms |
204 KB |
Output is correct |
114 |
Correct |
0 ms |
204 KB |
Output is correct |
115 |
Correct |
0 ms |
204 KB |
Output is correct |
116 |
Correct |
0 ms |
204 KB |
Output is correct |
117 |
Correct |
0 ms |
204 KB |
Output is correct |
118 |
Correct |
0 ms |
204 KB |
Output is correct |
119 |
Correct |
2 ms |
588 KB |
Output is correct |
120 |
Correct |
4 ms |
716 KB |
Output is correct |
121 |
Correct |
229 ms |
18620 KB |
Output is correct |
122 |
Correct |
359 ms |
26860 KB |
Output is correct |
123 |
Correct |
363 ms |
26908 KB |
Output is correct |
124 |
Correct |
0 ms |
204 KB |
Output is correct |
125 |
Correct |
0 ms |
204 KB |
Output is correct |
126 |
Correct |
0 ms |
204 KB |
Output is correct |
127 |
Correct |
488 ms |
35524 KB |
Output is correct |
128 |
Correct |
513 ms |
35540 KB |
Output is correct |
129 |
Correct |
555 ms |
35260 KB |
Output is correct |
130 |
Correct |
5 ms |
784 KB |
Output is correct |
131 |
Correct |
10 ms |
1484 KB |
Output is correct |
132 |
Correct |
233 ms |
18680 KB |
Output is correct |
133 |
Correct |
446 ms |
27844 KB |
Output is correct |
134 |
Correct |
649 ms |
37144 KB |
Output is correct |
135 |
Correct |
1264 ms |
82716 KB |
Output is correct |
136 |
Correct |
1350 ms |
82000 KB |
Output is correct |
137 |
Correct |
1352 ms |
60168 KB |
Output is correct |
138 |
Correct |
1923 ms |
71556 KB |
Output is correct |
139 |
Correct |
1370 ms |
70368 KB |
Output is correct |
140 |
Correct |
0 ms |
204 KB |
Output is correct |
141 |
Correct |
178 ms |
10812 KB |
Output is correct |
142 |
Correct |
47 ms |
5024 KB |
Output is correct |
143 |
Correct |
275 ms |
16880 KB |
Output is correct |
144 |
Correct |
579 ms |
28928 KB |
Output is correct |
145 |
Correct |
806 ms |
34648 KB |
Output is correct |
146 |
Correct |
1229 ms |
43596 KB |
Output is correct |
147 |
Correct |
1449 ms |
52828 KB |
Output is correct |
148 |
Correct |
1598 ms |
61244 KB |
Output is correct |
149 |
Correct |
2045 ms |
69256 KB |
Output is correct |
150 |
Correct |
662 ms |
43004 KB |
Output is correct |
151 |
Correct |
508 ms |
35508 KB |
Output is correct |
152 |
Correct |
6 ms |
1100 KB |
Output is correct |
153 |
Correct |
13 ms |
1772 KB |
Output is correct |
154 |
Correct |
279 ms |
19692 KB |
Output is correct |
155 |
Correct |
501 ms |
29616 KB |
Output is correct |
156 |
Correct |
660 ms |
39300 KB |
Output is correct |
157 |
Correct |
0 ms |
204 KB |
Output is correct |
158 |
Correct |
1 ms |
204 KB |
Output is correct |
159 |
Correct |
1 ms |
208 KB |
Output is correct |
160 |
Correct |
1 ms |
204 KB |
Output is correct |
161 |
Incorrect |
1734 ms |
66024 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |