#include<bits/stdc++.h>
#include "parks.h"
#define MAXN 800007
using namespace std;
struct bench{
int from,to;
int a,b;
};
int n,curr,benches,br,k,comp[MAXN],ans[MAXN],dsu[MAXN],w[MAXN],sz[MAXN];
bool li[MAXN];
vector<int> v[MAXN],r[MAXN];
stack<int> st;
vector<bench> sol;
vector<int> A,B,C,D;
vector< pair<int,int> > ors;
unordered_map<long long, int> mp;
unordered_map<long long, vector<int> > bro;
int op(int x){
if(x<400000)return x+400000;
return x-400000;
}
void add(long long x,long long y,int z){
for(int i=0;i<bro[x*300000+y].size();i++){
ors.push_back({op(bro[x*300000+y][i]),op(z)});
}
bro[x*300000+y].push_back(z);
}
void dfs(int x){
li[x]=true;
for(int i=0;i<v[x].size();i++){
if(!li[v[x][i]])dfs(v[x][i]);
}
st.push(x);
}
void scc(int x){
comp[x]=k;
li[x]=true;
for(int i=0;i<r[x].size();i++){
if(!li[r[x][i]])scc(r[x][i]);
}
}
int root(int x){
if(dsu[x]==x)return x;
dsu[x]=root(dsu[x]);
return dsu[x];
}
void mergev(int x,int y){
if(sz[root(x)]<sz[root(y)])swap(x,y);
sz[root(x)]+=sz[root(y)];
dsu[root(y)]=root(x);
}
vector<long long> x,y;
void dfss(long long x,long long y){
int ss=mp[x*300000+y]-1;
curr=mp[(x-2)*300000+y];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
add(x-1,y-1,br);
add(x-1,y+1,br+1);
ors.push_back({br,br+1});
br+=2;
dfss(x-2,y);
}
curr=mp[(x+2)*300000+y];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
add(x+1,y-1,br);
add(x+1,y+1,br+1);
ors.push_back({br,br+1});
br+=2;
dfss(x+2,y);
}
curr=mp[x*300000+y-2];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
add(x-1,y-1,br);
add(x+1,y-1,br+1);
ors.push_back({br,br+1});
br+=2;
dfss(x,y-2);
}
curr=mp[x*300000+y+2];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
add(x-1,y+1,br);
add(x+1,y+1,br+1);
ors.push_back({br,br+1});
br+=2;
dfss(x,y+2);
}
}
void dfss2(long long x,long long y){
int ss=mp[x*300000+y]-1;
curr=mp[(x-2)*300000+y];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
if(ans[br]==1){
sol.push_back({curr,ss,x-1,y-1});
}else{
sol.push_back({curr,ss,x-1,y+1});
}
br+=2;
dfss2(x-2,y);
}
curr=mp[(x+2)*300000+y];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
if(ans[br]==1){
sol.push_back({curr,ss,x+1,y-1});
}else{
sol.push_back({curr,ss,x+1,y+1});
}
br+=2;
dfss2(x+2,y);
}
curr=mp[x*300000+y-2];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
if(ans[br]==1){
sol.push_back({curr,ss,x-1,y-1});
}else{
sol.push_back({curr,ss,x+1,y-1});
}
br+=2;
dfss2(x,y-2);
}
curr=mp[x*300000+y+2];
if(curr!=0 and root(ss)!=root(curr-1)){
curr--; mergev(ss,curr);
if(ans[br]==1){
sol.push_back({curr,ss,x-1,y+1});
}else{
sol.push_back({curr,ss,x+1,y+1});
}
br+=2;
dfss2(x,y+2);
}
}
int construct_roads(vector<int> X,vector<int> Y){
n=int(X.size());
x.resize(n); y.resize(n);
for(int i=0;i<n;i++){
dsu[i]=i; sz[i]=1;
x[i]=X[i]; y[i]=Y[i];
mp[x[i]*300000+y[i]]=i+1;
}
br=0;
dfss(x[0],y[0]);
if(br!=2*n-2)return 0;
for(int i=0;i<ors.size();i++){
v[op(ors[i].first)].push_back(ors[i].second);
r[ors[i].second].push_back(op(ors[i].first));
v[op(ors[i].second)].push_back(ors[i].first);
r[ors[i].first].push_back(op(ors[i].second));
}
for(int i=0;i<800000;i++){
if(!li[i])dfs(i);
}
for(int i=0;i<800000;i++)li[i]=false;
while(!st.empty()){
if(!li[st.top()]){
k++; scc(st.top());
}
st.pop();
}
for(int i=0;i<br;i++){
if(comp[i]==comp[op(i)])return 0;
if(comp[i]<comp[op(i)])ans[i]=0;
else ans[i]=1;
}
for(int i=0;i<n;i++){
dsu[i]=i; sz[i]=1;
}
br=0;
dfss2(x[0],y[0]);
for(int i=0;i<sol.size();i++){
A.push_back(sol[i].from);
B.push_back(sol[i].to);
C.push_back(sol[i].a);
D.push_back(sol[i].b);
}
build(A,B,C,D);
return 1;
}
/*
int main(){
cout<<construct_roads({2,2,2,2,4,4,4,4,6,6,6,6,8,8,8,8}, {2,4,6,8,2,4,6,8,2,4,6,8,2,4,6,8});
}
*/
Compilation message
parks.cpp: In function 'void add(long long int, long long int, int)':
parks.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for(int i=0;i<bro[x*300000+y].size();i++){
| ~^~~~~~~~~~~~~~~~~~~~~~~
parks.cpp: In function 'void dfs(int)':
parks.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | for(int i=0;i<v[x].size();i++){
| ~^~~~~~~~~~~~
parks.cpp: In function 'void scc(int)':
parks.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | for(int i=0;i<r[x].size();i++){
| ~^~~~~~~~~~~~
parks.cpp: In function 'void dfss2(long long int, long long int)':
parks.cpp:127:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
127 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
parks.cpp:127:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
127 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
parks.cpp:129:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
129 | sol.push_back({curr,ss,x-1,y+1});
| ~^~
parks.cpp:129:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
129 | sol.push_back({curr,ss,x-1,y+1});
| ~^~
parks.cpp:141:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
141 | sol.push_back({curr,ss,x+1,y-1});
| ~^~
parks.cpp:141:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
141 | sol.push_back({curr,ss,x+1,y-1});
| ~^~
parks.cpp:143:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
143 | sol.push_back({curr,ss,x+1,y+1});
| ~^~
parks.cpp:143:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
143 | sol.push_back({curr,ss,x+1,y+1});
| ~^~
parks.cpp:155:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
155 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
parks.cpp:155:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
155 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
parks.cpp:157:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
157 | sol.push_back({curr,ss,x+1,y-1});
| ~^~
parks.cpp:157:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
157 | sol.push_back({curr,ss,x+1,y-1});
| ~^~
parks.cpp:169:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
169 | sol.push_back({curr,ss,x-1,y+1});
| ~^~
parks.cpp:169:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
169 | sol.push_back({curr,ss,x-1,y+1});
| ~^~
parks.cpp:171:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
171 | sol.push_back({curr,ss,x+1,y+1});
| ~^~
parks.cpp:171:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
171 | sol.push_back({curr,ss,x+1,y+1});
| ~^~
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:194:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
194 | for(int i=0;i<ors.size();i++){
| ~^~~~~~~~~~~
parks.cpp:226:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
226 | for(int i=0;i<sol.size();i++){
| ~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
28 ms |
45020 KB |
Output is correct |
3 |
Correct |
18 ms |
37844 KB |
Output is correct |
4 |
Correct |
27 ms |
45084 KB |
Output is correct |
5 |
Correct |
28 ms |
44972 KB |
Output is correct |
6 |
Correct |
17 ms |
37812 KB |
Output is correct |
7 |
Correct |
20 ms |
37848 KB |
Output is correct |
8 |
Correct |
18 ms |
37844 KB |
Output is correct |
9 |
Correct |
207 ms |
99992 KB |
Output is correct |
10 |
Correct |
37 ms |
50012 KB |
Output is correct |
11 |
Correct |
84 ms |
72432 KB |
Output is correct |
12 |
Correct |
49 ms |
52756 KB |
Output is correct |
13 |
Correct |
39 ms |
49848 KB |
Output is correct |
14 |
Correct |
19 ms |
38100 KB |
Output is correct |
15 |
Correct |
18 ms |
38212 KB |
Output is correct |
16 |
Correct |
217 ms |
106884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
28 ms |
45020 KB |
Output is correct |
3 |
Correct |
18 ms |
37844 KB |
Output is correct |
4 |
Correct |
27 ms |
45084 KB |
Output is correct |
5 |
Correct |
28 ms |
44972 KB |
Output is correct |
6 |
Correct |
17 ms |
37812 KB |
Output is correct |
7 |
Correct |
20 ms |
37848 KB |
Output is correct |
8 |
Correct |
18 ms |
37844 KB |
Output is correct |
9 |
Correct |
207 ms |
99992 KB |
Output is correct |
10 |
Correct |
37 ms |
50012 KB |
Output is correct |
11 |
Correct |
84 ms |
72432 KB |
Output is correct |
12 |
Correct |
49 ms |
52756 KB |
Output is correct |
13 |
Correct |
39 ms |
49848 KB |
Output is correct |
14 |
Correct |
19 ms |
38100 KB |
Output is correct |
15 |
Correct |
18 ms |
38212 KB |
Output is correct |
16 |
Correct |
217 ms |
106884 KB |
Output is correct |
17 |
Correct |
27 ms |
45032 KB |
Output is correct |
18 |
Correct |
27 ms |
44968 KB |
Output is correct |
19 |
Correct |
27 ms |
44964 KB |
Output is correct |
20 |
Correct |
28 ms |
44972 KB |
Output is correct |
21 |
Correct |
18 ms |
37836 KB |
Output is correct |
22 |
Correct |
27 ms |
45012 KB |
Output is correct |
23 |
Correct |
632 ms |
181008 KB |
Output is correct |
24 |
Correct |
32 ms |
45048 KB |
Output is correct |
25 |
Correct |
36 ms |
45732 KB |
Output is correct |
26 |
Correct |
21 ms |
38356 KB |
Output is correct |
27 |
Correct |
20 ms |
38320 KB |
Output is correct |
28 |
Correct |
170 ms |
97500 KB |
Output is correct |
29 |
Correct |
265 ms |
114280 KB |
Output is correct |
30 |
Correct |
358 ms |
140152 KB |
Output is correct |
31 |
Correct |
581 ms |
178024 KB |
Output is correct |
32 |
Correct |
28 ms |
45012 KB |
Output is correct |
33 |
Correct |
28 ms |
44976 KB |
Output is correct |
34 |
Correct |
28 ms |
45012 KB |
Output is correct |
35 |
Correct |
18 ms |
37844 KB |
Output is correct |
36 |
Correct |
18 ms |
37796 KB |
Output is correct |
37 |
Correct |
28 ms |
45000 KB |
Output is correct |
38 |
Correct |
28 ms |
45016 KB |
Output is correct |
39 |
Correct |
28 ms |
45012 KB |
Output is correct |
40 |
Correct |
42 ms |
45064 KB |
Output is correct |
41 |
Correct |
21 ms |
37824 KB |
Output is correct |
42 |
Correct |
28 ms |
44980 KB |
Output is correct |
43 |
Correct |
19 ms |
38356 KB |
Output is correct |
44 |
Correct |
20 ms |
38208 KB |
Output is correct |
45 |
Correct |
208 ms |
108580 KB |
Output is correct |
46 |
Correct |
361 ms |
139968 KB |
Output is correct |
47 |
Correct |
355 ms |
138884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
28 ms |
45020 KB |
Output is correct |
3 |
Correct |
18 ms |
37844 KB |
Output is correct |
4 |
Correct |
27 ms |
45084 KB |
Output is correct |
5 |
Correct |
28 ms |
44972 KB |
Output is correct |
6 |
Correct |
17 ms |
37812 KB |
Output is correct |
7 |
Correct |
20 ms |
37848 KB |
Output is correct |
8 |
Correct |
18 ms |
37844 KB |
Output is correct |
9 |
Correct |
207 ms |
99992 KB |
Output is correct |
10 |
Correct |
37 ms |
50012 KB |
Output is correct |
11 |
Correct |
84 ms |
72432 KB |
Output is correct |
12 |
Correct |
49 ms |
52756 KB |
Output is correct |
13 |
Correct |
39 ms |
49848 KB |
Output is correct |
14 |
Correct |
19 ms |
38100 KB |
Output is correct |
15 |
Correct |
18 ms |
38212 KB |
Output is correct |
16 |
Correct |
217 ms |
106884 KB |
Output is correct |
17 |
Correct |
27 ms |
45032 KB |
Output is correct |
18 |
Correct |
27 ms |
44968 KB |
Output is correct |
19 |
Correct |
27 ms |
44964 KB |
Output is correct |
20 |
Correct |
28 ms |
44972 KB |
Output is correct |
21 |
Correct |
18 ms |
37836 KB |
Output is correct |
22 |
Correct |
27 ms |
45012 KB |
Output is correct |
23 |
Correct |
632 ms |
181008 KB |
Output is correct |
24 |
Correct |
32 ms |
45048 KB |
Output is correct |
25 |
Correct |
36 ms |
45732 KB |
Output is correct |
26 |
Correct |
21 ms |
38356 KB |
Output is correct |
27 |
Correct |
20 ms |
38320 KB |
Output is correct |
28 |
Correct |
170 ms |
97500 KB |
Output is correct |
29 |
Correct |
265 ms |
114280 KB |
Output is correct |
30 |
Correct |
358 ms |
140152 KB |
Output is correct |
31 |
Correct |
581 ms |
178024 KB |
Output is correct |
32 |
Correct |
28 ms |
45012 KB |
Output is correct |
33 |
Correct |
28 ms |
44976 KB |
Output is correct |
34 |
Correct |
28 ms |
45012 KB |
Output is correct |
35 |
Correct |
18 ms |
37844 KB |
Output is correct |
36 |
Correct |
18 ms |
37796 KB |
Output is correct |
37 |
Correct |
28 ms |
45000 KB |
Output is correct |
38 |
Correct |
28 ms |
45016 KB |
Output is correct |
39 |
Correct |
28 ms |
45012 KB |
Output is correct |
40 |
Correct |
42 ms |
45064 KB |
Output is correct |
41 |
Correct |
21 ms |
37824 KB |
Output is correct |
42 |
Correct |
28 ms |
44980 KB |
Output is correct |
43 |
Correct |
19 ms |
38356 KB |
Output is correct |
44 |
Correct |
20 ms |
38208 KB |
Output is correct |
45 |
Correct |
208 ms |
108580 KB |
Output is correct |
46 |
Correct |
361 ms |
139968 KB |
Output is correct |
47 |
Correct |
355 ms |
138884 KB |
Output is correct |
48 |
Correct |
28 ms |
45012 KB |
Output is correct |
49 |
Correct |
33 ms |
45000 KB |
Output is correct |
50 |
Correct |
28 ms |
45012 KB |
Output is correct |
51 |
Correct |
29 ms |
45048 KB |
Output is correct |
52 |
Correct |
28 ms |
45012 KB |
Output is correct |
53 |
Correct |
29 ms |
45084 KB |
Output is correct |
54 |
Correct |
28 ms |
45004 KB |
Output is correct |
55 |
Correct |
543 ms |
172352 KB |
Output is correct |
56 |
Correct |
28 ms |
45008 KB |
Output is correct |
57 |
Correct |
34 ms |
46136 KB |
Output is correct |
58 |
Correct |
41 ms |
48660 KB |
Output is correct |
59 |
Correct |
25 ms |
39168 KB |
Output is correct |
60 |
Correct |
224 ms |
105132 KB |
Output is correct |
61 |
Correct |
341 ms |
134992 KB |
Output is correct |
62 |
Correct |
404 ms |
150340 KB |
Output is correct |
63 |
Correct |
521 ms |
164184 KB |
Output is correct |
64 |
Correct |
20 ms |
37852 KB |
Output is correct |
65 |
Correct |
28 ms |
45012 KB |
Output is correct |
66 |
Correct |
18 ms |
37844 KB |
Output is correct |
67 |
Correct |
502 ms |
169252 KB |
Output is correct |
68 |
Correct |
491 ms |
160756 KB |
Output is correct |
69 |
Correct |
464 ms |
163588 KB |
Output is correct |
70 |
Correct |
19 ms |
38612 KB |
Output is correct |
71 |
Correct |
21 ms |
38996 KB |
Output is correct |
72 |
Correct |
216 ms |
102436 KB |
Output is correct |
73 |
Correct |
337 ms |
129200 KB |
Output is correct |
74 |
Correct |
518 ms |
163892 KB |
Output is correct |
75 |
Correct |
488 ms |
166516 KB |
Output is correct |
76 |
Correct |
468 ms |
169324 KB |
Output is correct |
77 |
Correct |
21 ms |
38740 KB |
Output is correct |
78 |
Correct |
21 ms |
39508 KB |
Output is correct |
79 |
Correct |
253 ms |
106152 KB |
Output is correct |
80 |
Correct |
400 ms |
139612 KB |
Output is correct |
81 |
Correct |
496 ms |
161788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
28 ms |
45020 KB |
Output is correct |
3 |
Correct |
18 ms |
37844 KB |
Output is correct |
4 |
Correct |
27 ms |
45084 KB |
Output is correct |
5 |
Correct |
28 ms |
44972 KB |
Output is correct |
6 |
Correct |
17 ms |
37812 KB |
Output is correct |
7 |
Correct |
20 ms |
37848 KB |
Output is correct |
8 |
Correct |
18 ms |
37844 KB |
Output is correct |
9 |
Correct |
207 ms |
99992 KB |
Output is correct |
10 |
Correct |
37 ms |
50012 KB |
Output is correct |
11 |
Correct |
84 ms |
72432 KB |
Output is correct |
12 |
Correct |
49 ms |
52756 KB |
Output is correct |
13 |
Correct |
39 ms |
49848 KB |
Output is correct |
14 |
Correct |
19 ms |
38100 KB |
Output is correct |
15 |
Correct |
18 ms |
38212 KB |
Output is correct |
16 |
Correct |
217 ms |
106884 KB |
Output is correct |
17 |
Correct |
28 ms |
45044 KB |
Output is correct |
18 |
Correct |
28 ms |
45040 KB |
Output is correct |
19 |
Correct |
18 ms |
37804 KB |
Output is correct |
20 |
Correct |
478 ms |
177912 KB |
Output is correct |
21 |
Correct |
527 ms |
176020 KB |
Output is correct |
22 |
Correct |
507 ms |
172472 KB |
Output is correct |
23 |
Correct |
471 ms |
154196 KB |
Output is correct |
24 |
Correct |
86 ms |
54956 KB |
Output is correct |
25 |
Correct |
70 ms |
54924 KB |
Output is correct |
26 |
Correct |
69 ms |
54940 KB |
Output is correct |
27 |
Correct |
523 ms |
150676 KB |
Output is correct |
28 |
Correct |
528 ms |
150636 KB |
Output is correct |
29 |
Correct |
464 ms |
150740 KB |
Output is correct |
30 |
Correct |
428 ms |
150664 KB |
Output is correct |
31 |
Correct |
29 ms |
45028 KB |
Output is correct |
32 |
Correct |
61 ms |
52772 KB |
Output is correct |
33 |
Correct |
43 ms |
46332 KB |
Output is correct |
34 |
Correct |
504 ms |
174812 KB |
Output is correct |
35 |
Correct |
23 ms |
39492 KB |
Output is correct |
36 |
Correct |
36 ms |
43500 KB |
Output is correct |
37 |
Correct |
53 ms |
47824 KB |
Output is correct |
38 |
Correct |
176 ms |
87076 KB |
Output is correct |
39 |
Correct |
243 ms |
103520 KB |
Output is correct |
40 |
Correct |
325 ms |
120080 KB |
Output is correct |
41 |
Correct |
453 ms |
137020 KB |
Output is correct |
42 |
Correct |
553 ms |
152688 KB |
Output is correct |
43 |
Correct |
29 ms |
45012 KB |
Output is correct |
44 |
Correct |
28 ms |
45012 KB |
Output is correct |
45 |
Correct |
29 ms |
45004 KB |
Output is correct |
46 |
Correct |
19 ms |
37768 KB |
Output is correct |
47 |
Correct |
19 ms |
37836 KB |
Output is correct |
48 |
Correct |
29 ms |
44980 KB |
Output is correct |
49 |
Correct |
30 ms |
45004 KB |
Output is correct |
50 |
Correct |
29 ms |
45004 KB |
Output is correct |
51 |
Correct |
28 ms |
45068 KB |
Output is correct |
52 |
Correct |
19 ms |
37796 KB |
Output is correct |
53 |
Correct |
28 ms |
45004 KB |
Output is correct |
54 |
Correct |
20 ms |
38372 KB |
Output is correct |
55 |
Correct |
19 ms |
38228 KB |
Output is correct |
56 |
Correct |
223 ms |
108516 KB |
Output is correct |
57 |
Correct |
339 ms |
139980 KB |
Output is correct |
58 |
Correct |
346 ms |
138872 KB |
Output is correct |
59 |
Correct |
19 ms |
37844 KB |
Output is correct |
60 |
Correct |
29 ms |
45012 KB |
Output is correct |
61 |
Correct |
18 ms |
37772 KB |
Output is correct |
62 |
Correct |
596 ms |
169324 KB |
Output is correct |
63 |
Correct |
479 ms |
160708 KB |
Output is correct |
64 |
Correct |
527 ms |
163628 KB |
Output is correct |
65 |
Correct |
20 ms |
38612 KB |
Output is correct |
66 |
Correct |
20 ms |
39012 KB |
Output is correct |
67 |
Correct |
204 ms |
102412 KB |
Output is correct |
68 |
Correct |
334 ms |
129152 KB |
Output is correct |
69 |
Correct |
512 ms |
163992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
28 ms |
45020 KB |
Output is correct |
3 |
Correct |
18 ms |
37844 KB |
Output is correct |
4 |
Correct |
27 ms |
45084 KB |
Output is correct |
5 |
Correct |
28 ms |
44972 KB |
Output is correct |
6 |
Correct |
17 ms |
37812 KB |
Output is correct |
7 |
Correct |
20 ms |
37848 KB |
Output is correct |
8 |
Correct |
18 ms |
37844 KB |
Output is correct |
9 |
Correct |
207 ms |
99992 KB |
Output is correct |
10 |
Correct |
37 ms |
50012 KB |
Output is correct |
11 |
Correct |
84 ms |
72432 KB |
Output is correct |
12 |
Correct |
49 ms |
52756 KB |
Output is correct |
13 |
Correct |
39 ms |
49848 KB |
Output is correct |
14 |
Correct |
19 ms |
38100 KB |
Output is correct |
15 |
Correct |
18 ms |
38212 KB |
Output is correct |
16 |
Correct |
217 ms |
106884 KB |
Output is correct |
17 |
Correct |
649 ms |
180668 KB |
Output is correct |
18 |
Correct |
703 ms |
177724 KB |
Output is correct |
19 |
Correct |
628 ms |
182772 KB |
Output is correct |
20 |
Correct |
510 ms |
163612 KB |
Output is correct |
21 |
Correct |
557 ms |
151124 KB |
Output is correct |
22 |
Correct |
29 ms |
45012 KB |
Output is correct |
23 |
Correct |
87 ms |
60956 KB |
Output is correct |
24 |
Correct |
29 ms |
41672 KB |
Output is correct |
25 |
Correct |
42 ms |
45488 KB |
Output is correct |
26 |
Correct |
59 ms |
49940 KB |
Output is correct |
27 |
Correct |
211 ms |
101276 KB |
Output is correct |
28 |
Correct |
326 ms |
116868 KB |
Output is correct |
29 |
Correct |
411 ms |
133404 KB |
Output is correct |
30 |
Correct |
548 ms |
147480 KB |
Output is correct |
31 |
Correct |
590 ms |
161940 KB |
Output is correct |
32 |
Correct |
511 ms |
166336 KB |
Output is correct |
33 |
Correct |
510 ms |
169320 KB |
Output is correct |
34 |
Correct |
21 ms |
38740 KB |
Output is correct |
35 |
Correct |
22 ms |
39508 KB |
Output is correct |
36 |
Correct |
219 ms |
106148 KB |
Output is correct |
37 |
Correct |
370 ms |
139576 KB |
Output is correct |
38 |
Correct |
545 ms |
161812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
28 ms |
45020 KB |
Output is correct |
3 |
Correct |
18 ms |
37844 KB |
Output is correct |
4 |
Correct |
27 ms |
45084 KB |
Output is correct |
5 |
Correct |
28 ms |
44972 KB |
Output is correct |
6 |
Correct |
17 ms |
37812 KB |
Output is correct |
7 |
Correct |
20 ms |
37848 KB |
Output is correct |
8 |
Correct |
18 ms |
37844 KB |
Output is correct |
9 |
Correct |
207 ms |
99992 KB |
Output is correct |
10 |
Correct |
37 ms |
50012 KB |
Output is correct |
11 |
Correct |
84 ms |
72432 KB |
Output is correct |
12 |
Correct |
49 ms |
52756 KB |
Output is correct |
13 |
Correct |
39 ms |
49848 KB |
Output is correct |
14 |
Correct |
19 ms |
38100 KB |
Output is correct |
15 |
Correct |
18 ms |
38212 KB |
Output is correct |
16 |
Correct |
217 ms |
106884 KB |
Output is correct |
17 |
Correct |
27 ms |
45032 KB |
Output is correct |
18 |
Correct |
27 ms |
44968 KB |
Output is correct |
19 |
Correct |
27 ms |
44964 KB |
Output is correct |
20 |
Correct |
28 ms |
44972 KB |
Output is correct |
21 |
Correct |
18 ms |
37836 KB |
Output is correct |
22 |
Correct |
27 ms |
45012 KB |
Output is correct |
23 |
Correct |
632 ms |
181008 KB |
Output is correct |
24 |
Correct |
32 ms |
45048 KB |
Output is correct |
25 |
Correct |
36 ms |
45732 KB |
Output is correct |
26 |
Correct |
21 ms |
38356 KB |
Output is correct |
27 |
Correct |
20 ms |
38320 KB |
Output is correct |
28 |
Correct |
170 ms |
97500 KB |
Output is correct |
29 |
Correct |
265 ms |
114280 KB |
Output is correct |
30 |
Correct |
358 ms |
140152 KB |
Output is correct |
31 |
Correct |
581 ms |
178024 KB |
Output is correct |
32 |
Correct |
28 ms |
45012 KB |
Output is correct |
33 |
Correct |
28 ms |
44976 KB |
Output is correct |
34 |
Correct |
28 ms |
45012 KB |
Output is correct |
35 |
Correct |
18 ms |
37844 KB |
Output is correct |
36 |
Correct |
18 ms |
37796 KB |
Output is correct |
37 |
Correct |
28 ms |
45000 KB |
Output is correct |
38 |
Correct |
28 ms |
45016 KB |
Output is correct |
39 |
Correct |
28 ms |
45012 KB |
Output is correct |
40 |
Correct |
42 ms |
45064 KB |
Output is correct |
41 |
Correct |
21 ms |
37824 KB |
Output is correct |
42 |
Correct |
28 ms |
44980 KB |
Output is correct |
43 |
Correct |
19 ms |
38356 KB |
Output is correct |
44 |
Correct |
20 ms |
38208 KB |
Output is correct |
45 |
Correct |
208 ms |
108580 KB |
Output is correct |
46 |
Correct |
361 ms |
139968 KB |
Output is correct |
47 |
Correct |
355 ms |
138884 KB |
Output is correct |
48 |
Correct |
28 ms |
45012 KB |
Output is correct |
49 |
Correct |
33 ms |
45000 KB |
Output is correct |
50 |
Correct |
28 ms |
45012 KB |
Output is correct |
51 |
Correct |
29 ms |
45048 KB |
Output is correct |
52 |
Correct |
28 ms |
45012 KB |
Output is correct |
53 |
Correct |
29 ms |
45084 KB |
Output is correct |
54 |
Correct |
28 ms |
45004 KB |
Output is correct |
55 |
Correct |
543 ms |
172352 KB |
Output is correct |
56 |
Correct |
28 ms |
45008 KB |
Output is correct |
57 |
Correct |
34 ms |
46136 KB |
Output is correct |
58 |
Correct |
41 ms |
48660 KB |
Output is correct |
59 |
Correct |
25 ms |
39168 KB |
Output is correct |
60 |
Correct |
224 ms |
105132 KB |
Output is correct |
61 |
Correct |
341 ms |
134992 KB |
Output is correct |
62 |
Correct |
404 ms |
150340 KB |
Output is correct |
63 |
Correct |
521 ms |
164184 KB |
Output is correct |
64 |
Correct |
20 ms |
37852 KB |
Output is correct |
65 |
Correct |
28 ms |
45012 KB |
Output is correct |
66 |
Correct |
18 ms |
37844 KB |
Output is correct |
67 |
Correct |
502 ms |
169252 KB |
Output is correct |
68 |
Correct |
491 ms |
160756 KB |
Output is correct |
69 |
Correct |
464 ms |
163588 KB |
Output is correct |
70 |
Correct |
19 ms |
38612 KB |
Output is correct |
71 |
Correct |
21 ms |
38996 KB |
Output is correct |
72 |
Correct |
216 ms |
102436 KB |
Output is correct |
73 |
Correct |
337 ms |
129200 KB |
Output is correct |
74 |
Correct |
518 ms |
163892 KB |
Output is correct |
75 |
Correct |
488 ms |
166516 KB |
Output is correct |
76 |
Correct |
468 ms |
169324 KB |
Output is correct |
77 |
Correct |
21 ms |
38740 KB |
Output is correct |
78 |
Correct |
21 ms |
39508 KB |
Output is correct |
79 |
Correct |
253 ms |
106152 KB |
Output is correct |
80 |
Correct |
400 ms |
139612 KB |
Output is correct |
81 |
Correct |
496 ms |
161788 KB |
Output is correct |
82 |
Correct |
28 ms |
45044 KB |
Output is correct |
83 |
Correct |
28 ms |
45040 KB |
Output is correct |
84 |
Correct |
18 ms |
37804 KB |
Output is correct |
85 |
Correct |
478 ms |
177912 KB |
Output is correct |
86 |
Correct |
527 ms |
176020 KB |
Output is correct |
87 |
Correct |
507 ms |
172472 KB |
Output is correct |
88 |
Correct |
471 ms |
154196 KB |
Output is correct |
89 |
Correct |
86 ms |
54956 KB |
Output is correct |
90 |
Correct |
70 ms |
54924 KB |
Output is correct |
91 |
Correct |
69 ms |
54940 KB |
Output is correct |
92 |
Correct |
523 ms |
150676 KB |
Output is correct |
93 |
Correct |
528 ms |
150636 KB |
Output is correct |
94 |
Correct |
464 ms |
150740 KB |
Output is correct |
95 |
Correct |
428 ms |
150664 KB |
Output is correct |
96 |
Correct |
29 ms |
45028 KB |
Output is correct |
97 |
Correct |
61 ms |
52772 KB |
Output is correct |
98 |
Correct |
43 ms |
46332 KB |
Output is correct |
99 |
Correct |
504 ms |
174812 KB |
Output is correct |
100 |
Correct |
23 ms |
39492 KB |
Output is correct |
101 |
Correct |
36 ms |
43500 KB |
Output is correct |
102 |
Correct |
53 ms |
47824 KB |
Output is correct |
103 |
Correct |
176 ms |
87076 KB |
Output is correct |
104 |
Correct |
243 ms |
103520 KB |
Output is correct |
105 |
Correct |
325 ms |
120080 KB |
Output is correct |
106 |
Correct |
453 ms |
137020 KB |
Output is correct |
107 |
Correct |
553 ms |
152688 KB |
Output is correct |
108 |
Correct |
29 ms |
45012 KB |
Output is correct |
109 |
Correct |
28 ms |
45012 KB |
Output is correct |
110 |
Correct |
29 ms |
45004 KB |
Output is correct |
111 |
Correct |
19 ms |
37768 KB |
Output is correct |
112 |
Correct |
19 ms |
37836 KB |
Output is correct |
113 |
Correct |
29 ms |
44980 KB |
Output is correct |
114 |
Correct |
30 ms |
45004 KB |
Output is correct |
115 |
Correct |
29 ms |
45004 KB |
Output is correct |
116 |
Correct |
28 ms |
45068 KB |
Output is correct |
117 |
Correct |
19 ms |
37796 KB |
Output is correct |
118 |
Correct |
28 ms |
45004 KB |
Output is correct |
119 |
Correct |
20 ms |
38372 KB |
Output is correct |
120 |
Correct |
19 ms |
38228 KB |
Output is correct |
121 |
Correct |
223 ms |
108516 KB |
Output is correct |
122 |
Correct |
339 ms |
139980 KB |
Output is correct |
123 |
Correct |
346 ms |
138872 KB |
Output is correct |
124 |
Correct |
19 ms |
37844 KB |
Output is correct |
125 |
Correct |
29 ms |
45012 KB |
Output is correct |
126 |
Correct |
18 ms |
37772 KB |
Output is correct |
127 |
Correct |
596 ms |
169324 KB |
Output is correct |
128 |
Correct |
479 ms |
160708 KB |
Output is correct |
129 |
Correct |
527 ms |
163628 KB |
Output is correct |
130 |
Correct |
20 ms |
38612 KB |
Output is correct |
131 |
Correct |
20 ms |
39012 KB |
Output is correct |
132 |
Correct |
204 ms |
102412 KB |
Output is correct |
133 |
Correct |
334 ms |
129152 KB |
Output is correct |
134 |
Correct |
512 ms |
163992 KB |
Output is correct |
135 |
Correct |
649 ms |
180668 KB |
Output is correct |
136 |
Correct |
703 ms |
177724 KB |
Output is correct |
137 |
Correct |
628 ms |
182772 KB |
Output is correct |
138 |
Correct |
510 ms |
163612 KB |
Output is correct |
139 |
Correct |
557 ms |
151124 KB |
Output is correct |
140 |
Correct |
29 ms |
45012 KB |
Output is correct |
141 |
Correct |
87 ms |
60956 KB |
Output is correct |
142 |
Correct |
29 ms |
41672 KB |
Output is correct |
143 |
Correct |
42 ms |
45488 KB |
Output is correct |
144 |
Correct |
59 ms |
49940 KB |
Output is correct |
145 |
Correct |
211 ms |
101276 KB |
Output is correct |
146 |
Correct |
326 ms |
116868 KB |
Output is correct |
147 |
Correct |
411 ms |
133404 KB |
Output is correct |
148 |
Correct |
548 ms |
147480 KB |
Output is correct |
149 |
Correct |
590 ms |
161940 KB |
Output is correct |
150 |
Correct |
511 ms |
166336 KB |
Output is correct |
151 |
Correct |
510 ms |
169320 KB |
Output is correct |
152 |
Correct |
21 ms |
38740 KB |
Output is correct |
153 |
Correct |
22 ms |
39508 KB |
Output is correct |
154 |
Correct |
219 ms |
106148 KB |
Output is correct |
155 |
Correct |
370 ms |
139576 KB |
Output is correct |
156 |
Correct |
545 ms |
161812 KB |
Output is correct |
157 |
Correct |
27 ms |
45012 KB |
Output is correct |
158 |
Correct |
17 ms |
37844 KB |
Output is correct |
159 |
Correct |
27 ms |
45064 KB |
Output is correct |
160 |
Correct |
28 ms |
45084 KB |
Output is correct |
161 |
Correct |
602 ms |
169032 KB |
Output is correct |
162 |
Correct |
602 ms |
180368 KB |
Output is correct |
163 |
Correct |
508 ms |
158740 KB |
Output is correct |
164 |
Correct |
584 ms |
159712 KB |
Output is correct |
165 |
Correct |
524 ms |
174668 KB |
Output is correct |
166 |
Correct |
544 ms |
179236 KB |
Output is correct |
167 |
Incorrect |
101 ms |
67316 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |