#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*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);
}
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);
}
}
void dfss2(long long x,long long y){
int ss=mp[x*300000+y]-1;
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);
}
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);
}
}
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:125:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
125 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
parks.cpp:125:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
125 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
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:139:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
139 | sol.push_back({curr,ss,x-1,y+1});
| ~^~
parks.cpp:139:41: warning: narrowing conversion of '(y + 1)' from 'long long int' to 'int' [-Wnarrowing]
139 | 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:153:37: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
153 | sol.push_back({curr,ss,x-1,y-1});
| ~^~
parks.cpp:153:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
153 | 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:167:37: warning: narrowing conversion of '(x + 1)' from 'long long int' to 'int' [-Wnarrowing]
167 | sol.push_back({curr,ss,x+1,y-1});
| ~^~
parks.cpp:167:41: warning: narrowing conversion of '(y - 1)' from 'long long int' to 'int' [-Wnarrowing]
167 | 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: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:192: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]
192 | for(int i=0;i<ors.size();i++){
| ~^~~~~~~~~~~
parks.cpp:224:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
224 | for(int i=0;i<sol.size();i++){
| ~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45048 KB |
Output is correct |
3 |
Correct |
17 ms |
37824 KB |
Output is correct |
4 |
Correct |
27 ms |
45012 KB |
Output is correct |
5 |
Correct |
28 ms |
45084 KB |
Output is correct |
6 |
Correct |
17 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37788 KB |
Output is correct |
8 |
Correct |
17 ms |
37844 KB |
Output is correct |
9 |
Correct |
193 ms |
110432 KB |
Output is correct |
10 |
Correct |
39 ms |
51320 KB |
Output is correct |
11 |
Correct |
86 ms |
79144 KB |
Output is correct |
12 |
Correct |
44 ms |
54584 KB |
Output is correct |
13 |
Correct |
41 ms |
53684 KB |
Output is correct |
14 |
Correct |
18 ms |
38132 KB |
Output is correct |
15 |
Correct |
19 ms |
38164 KB |
Output is correct |
16 |
Correct |
208 ms |
105168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45048 KB |
Output is correct |
3 |
Correct |
17 ms |
37824 KB |
Output is correct |
4 |
Correct |
27 ms |
45012 KB |
Output is correct |
5 |
Correct |
28 ms |
45084 KB |
Output is correct |
6 |
Correct |
17 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37788 KB |
Output is correct |
8 |
Correct |
17 ms |
37844 KB |
Output is correct |
9 |
Correct |
193 ms |
110432 KB |
Output is correct |
10 |
Correct |
39 ms |
51320 KB |
Output is correct |
11 |
Correct |
86 ms |
79144 KB |
Output is correct |
12 |
Correct |
44 ms |
54584 KB |
Output is correct |
13 |
Correct |
41 ms |
53684 KB |
Output is correct |
14 |
Correct |
18 ms |
38132 KB |
Output is correct |
15 |
Correct |
19 ms |
38164 KB |
Output is correct |
16 |
Correct |
208 ms |
105168 KB |
Output is correct |
17 |
Correct |
27 ms |
45100 KB |
Output is correct |
18 |
Correct |
26 ms |
45056 KB |
Output is correct |
19 |
Correct |
27 ms |
45040 KB |
Output is correct |
20 |
Correct |
28 ms |
45020 KB |
Output is correct |
21 |
Correct |
18 ms |
37844 KB |
Output is correct |
22 |
Correct |
27 ms |
45012 KB |
Output is correct |
23 |
Correct |
412 ms |
178156 KB |
Output is correct |
24 |
Correct |
27 ms |
45052 KB |
Output is correct |
25 |
Correct |
31 ms |
45772 KB |
Output is correct |
26 |
Correct |
19 ms |
38484 KB |
Output is correct |
27 |
Correct |
23 ms |
38384 KB |
Output is correct |
28 |
Correct |
148 ms |
95968 KB |
Output is correct |
29 |
Correct |
231 ms |
123548 KB |
Output is correct |
30 |
Correct |
304 ms |
149620 KB |
Output is correct |
31 |
Correct |
457 ms |
178244 KB |
Output is correct |
32 |
Correct |
27 ms |
45012 KB |
Output is correct |
33 |
Correct |
28 ms |
45024 KB |
Output is correct |
34 |
Correct |
28 ms |
44964 KB |
Output is correct |
35 |
Correct |
21 ms |
37844 KB |
Output is correct |
36 |
Correct |
21 ms |
37856 KB |
Output is correct |
37 |
Correct |
28 ms |
45096 KB |
Output is correct |
38 |
Correct |
28 ms |
45004 KB |
Output is correct |
39 |
Correct |
27 ms |
45036 KB |
Output is correct |
40 |
Correct |
28 ms |
45020 KB |
Output is correct |
41 |
Correct |
18 ms |
37852 KB |
Output is correct |
42 |
Correct |
27 ms |
45012 KB |
Output is correct |
43 |
Correct |
19 ms |
38268 KB |
Output is correct |
44 |
Correct |
21 ms |
38228 KB |
Output is correct |
45 |
Correct |
227 ms |
106056 KB |
Output is correct |
46 |
Correct |
361 ms |
136100 KB |
Output is correct |
47 |
Correct |
363 ms |
135480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45048 KB |
Output is correct |
3 |
Correct |
17 ms |
37824 KB |
Output is correct |
4 |
Correct |
27 ms |
45012 KB |
Output is correct |
5 |
Correct |
28 ms |
45084 KB |
Output is correct |
6 |
Correct |
17 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37788 KB |
Output is correct |
8 |
Correct |
17 ms |
37844 KB |
Output is correct |
9 |
Correct |
193 ms |
110432 KB |
Output is correct |
10 |
Correct |
39 ms |
51320 KB |
Output is correct |
11 |
Correct |
86 ms |
79144 KB |
Output is correct |
12 |
Correct |
44 ms |
54584 KB |
Output is correct |
13 |
Correct |
41 ms |
53684 KB |
Output is correct |
14 |
Correct |
18 ms |
38132 KB |
Output is correct |
15 |
Correct |
19 ms |
38164 KB |
Output is correct |
16 |
Correct |
208 ms |
105168 KB |
Output is correct |
17 |
Correct |
27 ms |
45100 KB |
Output is correct |
18 |
Correct |
26 ms |
45056 KB |
Output is correct |
19 |
Correct |
27 ms |
45040 KB |
Output is correct |
20 |
Correct |
28 ms |
45020 KB |
Output is correct |
21 |
Correct |
18 ms |
37844 KB |
Output is correct |
22 |
Correct |
27 ms |
45012 KB |
Output is correct |
23 |
Correct |
412 ms |
178156 KB |
Output is correct |
24 |
Correct |
27 ms |
45052 KB |
Output is correct |
25 |
Correct |
31 ms |
45772 KB |
Output is correct |
26 |
Correct |
19 ms |
38484 KB |
Output is correct |
27 |
Correct |
23 ms |
38384 KB |
Output is correct |
28 |
Correct |
148 ms |
95968 KB |
Output is correct |
29 |
Correct |
231 ms |
123548 KB |
Output is correct |
30 |
Correct |
304 ms |
149620 KB |
Output is correct |
31 |
Correct |
457 ms |
178244 KB |
Output is correct |
32 |
Correct |
27 ms |
45012 KB |
Output is correct |
33 |
Correct |
28 ms |
45024 KB |
Output is correct |
34 |
Correct |
28 ms |
44964 KB |
Output is correct |
35 |
Correct |
21 ms |
37844 KB |
Output is correct |
36 |
Correct |
21 ms |
37856 KB |
Output is correct |
37 |
Correct |
28 ms |
45096 KB |
Output is correct |
38 |
Correct |
28 ms |
45004 KB |
Output is correct |
39 |
Correct |
27 ms |
45036 KB |
Output is correct |
40 |
Correct |
28 ms |
45020 KB |
Output is correct |
41 |
Correct |
18 ms |
37852 KB |
Output is correct |
42 |
Correct |
27 ms |
45012 KB |
Output is correct |
43 |
Correct |
19 ms |
38268 KB |
Output is correct |
44 |
Correct |
21 ms |
38228 KB |
Output is correct |
45 |
Correct |
227 ms |
106056 KB |
Output is correct |
46 |
Correct |
361 ms |
136100 KB |
Output is correct |
47 |
Correct |
363 ms |
135480 KB |
Output is correct |
48 |
Correct |
28 ms |
45012 KB |
Output is correct |
49 |
Correct |
27 ms |
45056 KB |
Output is correct |
50 |
Correct |
28 ms |
44972 KB |
Output is correct |
51 |
Correct |
33 ms |
44996 KB |
Output is correct |
52 |
Correct |
29 ms |
45036 KB |
Output is correct |
53 |
Correct |
33 ms |
45068 KB |
Output is correct |
54 |
Correct |
28 ms |
45004 KB |
Output is correct |
55 |
Correct |
426 ms |
172712 KB |
Output is correct |
56 |
Correct |
28 ms |
45012 KB |
Output is correct |
57 |
Correct |
32 ms |
46036 KB |
Output is correct |
58 |
Correct |
36 ms |
48588 KB |
Output is correct |
59 |
Correct |
22 ms |
39328 KB |
Output is correct |
60 |
Correct |
208 ms |
104052 KB |
Output is correct |
61 |
Correct |
252 ms |
133336 KB |
Output is correct |
62 |
Correct |
320 ms |
151308 KB |
Output is correct |
63 |
Correct |
464 ms |
172376 KB |
Output is correct |
64 |
Correct |
19 ms |
37844 KB |
Output is correct |
65 |
Correct |
29 ms |
45072 KB |
Output is correct |
66 |
Correct |
19 ms |
37808 KB |
Output is correct |
67 |
Correct |
383 ms |
171476 KB |
Output is correct |
68 |
Correct |
408 ms |
171828 KB |
Output is correct |
69 |
Correct |
399 ms |
174096 KB |
Output is correct |
70 |
Correct |
20 ms |
38672 KB |
Output is correct |
71 |
Correct |
21 ms |
39124 KB |
Output is correct |
72 |
Correct |
219 ms |
102120 KB |
Output is correct |
73 |
Correct |
419 ms |
135304 KB |
Output is correct |
74 |
Correct |
515 ms |
163816 KB |
Output is correct |
75 |
Correct |
433 ms |
172016 KB |
Output is correct |
76 |
Correct |
415 ms |
178760 KB |
Output is correct |
77 |
Correct |
25 ms |
38796 KB |
Output is correct |
78 |
Correct |
22 ms |
39392 KB |
Output is correct |
79 |
Correct |
201 ms |
102128 KB |
Output is correct |
80 |
Correct |
407 ms |
132940 KB |
Output is correct |
81 |
Correct |
506 ms |
164372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45048 KB |
Output is correct |
3 |
Correct |
17 ms |
37824 KB |
Output is correct |
4 |
Correct |
27 ms |
45012 KB |
Output is correct |
5 |
Correct |
28 ms |
45084 KB |
Output is correct |
6 |
Correct |
17 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37788 KB |
Output is correct |
8 |
Correct |
17 ms |
37844 KB |
Output is correct |
9 |
Correct |
193 ms |
110432 KB |
Output is correct |
10 |
Correct |
39 ms |
51320 KB |
Output is correct |
11 |
Correct |
86 ms |
79144 KB |
Output is correct |
12 |
Correct |
44 ms |
54584 KB |
Output is correct |
13 |
Correct |
41 ms |
53684 KB |
Output is correct |
14 |
Correct |
18 ms |
38132 KB |
Output is correct |
15 |
Correct |
19 ms |
38164 KB |
Output is correct |
16 |
Correct |
208 ms |
105168 KB |
Output is correct |
17 |
Correct |
29 ms |
45064 KB |
Output is correct |
18 |
Correct |
32 ms |
44988 KB |
Output is correct |
19 |
Correct |
19 ms |
37824 KB |
Output is correct |
20 |
Correct |
545 ms |
184036 KB |
Output is correct |
21 |
Correct |
537 ms |
172740 KB |
Output is correct |
22 |
Correct |
507 ms |
174016 KB |
Output is correct |
23 |
Correct |
518 ms |
149760 KB |
Output is correct |
24 |
Correct |
70 ms |
54896 KB |
Output is correct |
25 |
Correct |
70 ms |
54904 KB |
Output is correct |
26 |
Correct |
69 ms |
55040 KB |
Output is correct |
27 |
Correct |
431 ms |
150704 KB |
Output is correct |
28 |
Correct |
440 ms |
150760 KB |
Output is correct |
29 |
Correct |
544 ms |
150620 KB |
Output is correct |
30 |
Correct |
510 ms |
150624 KB |
Output is correct |
31 |
Correct |
32 ms |
45072 KB |
Output is correct |
32 |
Correct |
51 ms |
52652 KB |
Output is correct |
33 |
Correct |
51 ms |
46284 KB |
Output is correct |
34 |
Correct |
576 ms |
174768 KB |
Output is correct |
35 |
Correct |
22 ms |
39500 KB |
Output is correct |
36 |
Correct |
43 ms |
43524 KB |
Output is correct |
37 |
Correct |
51 ms |
47764 KB |
Output is correct |
38 |
Correct |
168 ms |
87160 KB |
Output is correct |
39 |
Correct |
276 ms |
103508 KB |
Output is correct |
40 |
Correct |
323 ms |
120008 KB |
Output is correct |
41 |
Correct |
436 ms |
136996 KB |
Output is correct |
42 |
Correct |
553 ms |
152692 KB |
Output is correct |
43 |
Correct |
27 ms |
45044 KB |
Output is correct |
44 |
Correct |
33 ms |
45024 KB |
Output is correct |
45 |
Correct |
29 ms |
45044 KB |
Output is correct |
46 |
Correct |
22 ms |
37844 KB |
Output is correct |
47 |
Correct |
18 ms |
37844 KB |
Output is correct |
48 |
Correct |
27 ms |
44988 KB |
Output is correct |
49 |
Correct |
27 ms |
45100 KB |
Output is correct |
50 |
Correct |
27 ms |
45008 KB |
Output is correct |
51 |
Correct |
27 ms |
45060 KB |
Output is correct |
52 |
Correct |
19 ms |
37820 KB |
Output is correct |
53 |
Correct |
29 ms |
45004 KB |
Output is correct |
54 |
Correct |
19 ms |
38344 KB |
Output is correct |
55 |
Correct |
19 ms |
38208 KB |
Output is correct |
56 |
Correct |
235 ms |
106084 KB |
Output is correct |
57 |
Correct |
353 ms |
136088 KB |
Output is correct |
58 |
Correct |
356 ms |
135460 KB |
Output is correct |
59 |
Correct |
17 ms |
37844 KB |
Output is correct |
60 |
Correct |
27 ms |
44988 KB |
Output is correct |
61 |
Correct |
17 ms |
37860 KB |
Output is correct |
62 |
Correct |
410 ms |
171436 KB |
Output is correct |
63 |
Correct |
396 ms |
171816 KB |
Output is correct |
64 |
Correct |
382 ms |
174056 KB |
Output is correct |
65 |
Correct |
21 ms |
38680 KB |
Output is correct |
66 |
Correct |
20 ms |
39160 KB |
Output is correct |
67 |
Correct |
224 ms |
102108 KB |
Output is correct |
68 |
Correct |
368 ms |
135280 KB |
Output is correct |
69 |
Correct |
542 ms |
163836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45048 KB |
Output is correct |
3 |
Correct |
17 ms |
37824 KB |
Output is correct |
4 |
Correct |
27 ms |
45012 KB |
Output is correct |
5 |
Correct |
28 ms |
45084 KB |
Output is correct |
6 |
Correct |
17 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37788 KB |
Output is correct |
8 |
Correct |
17 ms |
37844 KB |
Output is correct |
9 |
Correct |
193 ms |
110432 KB |
Output is correct |
10 |
Correct |
39 ms |
51320 KB |
Output is correct |
11 |
Correct |
86 ms |
79144 KB |
Output is correct |
12 |
Correct |
44 ms |
54584 KB |
Output is correct |
13 |
Correct |
41 ms |
53684 KB |
Output is correct |
14 |
Correct |
18 ms |
38132 KB |
Output is correct |
15 |
Correct |
19 ms |
38164 KB |
Output is correct |
16 |
Correct |
208 ms |
105168 KB |
Output is correct |
17 |
Correct |
667 ms |
175888 KB |
Output is correct |
18 |
Correct |
836 ms |
173616 KB |
Output is correct |
19 |
Correct |
642 ms |
178036 KB |
Output is correct |
20 |
Correct |
469 ms |
158276 KB |
Output is correct |
21 |
Correct |
510 ms |
148356 KB |
Output is correct |
22 |
Correct |
28 ms |
45000 KB |
Output is correct |
23 |
Correct |
80 ms |
60716 KB |
Output is correct |
24 |
Correct |
35 ms |
41676 KB |
Output is correct |
25 |
Correct |
43 ms |
45476 KB |
Output is correct |
26 |
Correct |
70 ms |
49856 KB |
Output is correct |
27 |
Correct |
237 ms |
100108 KB |
Output is correct |
28 |
Correct |
294 ms |
115584 KB |
Output is correct |
29 |
Correct |
368 ms |
131176 KB |
Output is correct |
30 |
Correct |
492 ms |
145620 KB |
Output is correct |
31 |
Correct |
562 ms |
159024 KB |
Output is correct |
32 |
Correct |
444 ms |
172060 KB |
Output is correct |
33 |
Correct |
436 ms |
178676 KB |
Output is correct |
34 |
Correct |
23 ms |
38868 KB |
Output is correct |
35 |
Correct |
21 ms |
39516 KB |
Output is correct |
36 |
Correct |
209 ms |
102104 KB |
Output is correct |
37 |
Correct |
339 ms |
132944 KB |
Output is correct |
38 |
Correct |
506 ms |
164480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45048 KB |
Output is correct |
3 |
Correct |
17 ms |
37824 KB |
Output is correct |
4 |
Correct |
27 ms |
45012 KB |
Output is correct |
5 |
Correct |
28 ms |
45084 KB |
Output is correct |
6 |
Correct |
17 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37788 KB |
Output is correct |
8 |
Correct |
17 ms |
37844 KB |
Output is correct |
9 |
Correct |
193 ms |
110432 KB |
Output is correct |
10 |
Correct |
39 ms |
51320 KB |
Output is correct |
11 |
Correct |
86 ms |
79144 KB |
Output is correct |
12 |
Correct |
44 ms |
54584 KB |
Output is correct |
13 |
Correct |
41 ms |
53684 KB |
Output is correct |
14 |
Correct |
18 ms |
38132 KB |
Output is correct |
15 |
Correct |
19 ms |
38164 KB |
Output is correct |
16 |
Correct |
208 ms |
105168 KB |
Output is correct |
17 |
Correct |
27 ms |
45100 KB |
Output is correct |
18 |
Correct |
26 ms |
45056 KB |
Output is correct |
19 |
Correct |
27 ms |
45040 KB |
Output is correct |
20 |
Correct |
28 ms |
45020 KB |
Output is correct |
21 |
Correct |
18 ms |
37844 KB |
Output is correct |
22 |
Correct |
27 ms |
45012 KB |
Output is correct |
23 |
Correct |
412 ms |
178156 KB |
Output is correct |
24 |
Correct |
27 ms |
45052 KB |
Output is correct |
25 |
Correct |
31 ms |
45772 KB |
Output is correct |
26 |
Correct |
19 ms |
38484 KB |
Output is correct |
27 |
Correct |
23 ms |
38384 KB |
Output is correct |
28 |
Correct |
148 ms |
95968 KB |
Output is correct |
29 |
Correct |
231 ms |
123548 KB |
Output is correct |
30 |
Correct |
304 ms |
149620 KB |
Output is correct |
31 |
Correct |
457 ms |
178244 KB |
Output is correct |
32 |
Correct |
27 ms |
45012 KB |
Output is correct |
33 |
Correct |
28 ms |
45024 KB |
Output is correct |
34 |
Correct |
28 ms |
44964 KB |
Output is correct |
35 |
Correct |
21 ms |
37844 KB |
Output is correct |
36 |
Correct |
21 ms |
37856 KB |
Output is correct |
37 |
Correct |
28 ms |
45096 KB |
Output is correct |
38 |
Correct |
28 ms |
45004 KB |
Output is correct |
39 |
Correct |
27 ms |
45036 KB |
Output is correct |
40 |
Correct |
28 ms |
45020 KB |
Output is correct |
41 |
Correct |
18 ms |
37852 KB |
Output is correct |
42 |
Correct |
27 ms |
45012 KB |
Output is correct |
43 |
Correct |
19 ms |
38268 KB |
Output is correct |
44 |
Correct |
21 ms |
38228 KB |
Output is correct |
45 |
Correct |
227 ms |
106056 KB |
Output is correct |
46 |
Correct |
361 ms |
136100 KB |
Output is correct |
47 |
Correct |
363 ms |
135480 KB |
Output is correct |
48 |
Correct |
28 ms |
45012 KB |
Output is correct |
49 |
Correct |
27 ms |
45056 KB |
Output is correct |
50 |
Correct |
28 ms |
44972 KB |
Output is correct |
51 |
Correct |
33 ms |
44996 KB |
Output is correct |
52 |
Correct |
29 ms |
45036 KB |
Output is correct |
53 |
Correct |
33 ms |
45068 KB |
Output is correct |
54 |
Correct |
28 ms |
45004 KB |
Output is correct |
55 |
Correct |
426 ms |
172712 KB |
Output is correct |
56 |
Correct |
28 ms |
45012 KB |
Output is correct |
57 |
Correct |
32 ms |
46036 KB |
Output is correct |
58 |
Correct |
36 ms |
48588 KB |
Output is correct |
59 |
Correct |
22 ms |
39328 KB |
Output is correct |
60 |
Correct |
208 ms |
104052 KB |
Output is correct |
61 |
Correct |
252 ms |
133336 KB |
Output is correct |
62 |
Correct |
320 ms |
151308 KB |
Output is correct |
63 |
Correct |
464 ms |
172376 KB |
Output is correct |
64 |
Correct |
19 ms |
37844 KB |
Output is correct |
65 |
Correct |
29 ms |
45072 KB |
Output is correct |
66 |
Correct |
19 ms |
37808 KB |
Output is correct |
67 |
Correct |
383 ms |
171476 KB |
Output is correct |
68 |
Correct |
408 ms |
171828 KB |
Output is correct |
69 |
Correct |
399 ms |
174096 KB |
Output is correct |
70 |
Correct |
20 ms |
38672 KB |
Output is correct |
71 |
Correct |
21 ms |
39124 KB |
Output is correct |
72 |
Correct |
219 ms |
102120 KB |
Output is correct |
73 |
Correct |
419 ms |
135304 KB |
Output is correct |
74 |
Correct |
515 ms |
163816 KB |
Output is correct |
75 |
Correct |
433 ms |
172016 KB |
Output is correct |
76 |
Correct |
415 ms |
178760 KB |
Output is correct |
77 |
Correct |
25 ms |
38796 KB |
Output is correct |
78 |
Correct |
22 ms |
39392 KB |
Output is correct |
79 |
Correct |
201 ms |
102128 KB |
Output is correct |
80 |
Correct |
407 ms |
132940 KB |
Output is correct |
81 |
Correct |
506 ms |
164372 KB |
Output is correct |
82 |
Correct |
29 ms |
45064 KB |
Output is correct |
83 |
Correct |
32 ms |
44988 KB |
Output is correct |
84 |
Correct |
19 ms |
37824 KB |
Output is correct |
85 |
Correct |
545 ms |
184036 KB |
Output is correct |
86 |
Correct |
537 ms |
172740 KB |
Output is correct |
87 |
Correct |
507 ms |
174016 KB |
Output is correct |
88 |
Correct |
518 ms |
149760 KB |
Output is correct |
89 |
Correct |
70 ms |
54896 KB |
Output is correct |
90 |
Correct |
70 ms |
54904 KB |
Output is correct |
91 |
Correct |
69 ms |
55040 KB |
Output is correct |
92 |
Correct |
431 ms |
150704 KB |
Output is correct |
93 |
Correct |
440 ms |
150760 KB |
Output is correct |
94 |
Correct |
544 ms |
150620 KB |
Output is correct |
95 |
Correct |
510 ms |
150624 KB |
Output is correct |
96 |
Correct |
32 ms |
45072 KB |
Output is correct |
97 |
Correct |
51 ms |
52652 KB |
Output is correct |
98 |
Correct |
51 ms |
46284 KB |
Output is correct |
99 |
Correct |
576 ms |
174768 KB |
Output is correct |
100 |
Correct |
22 ms |
39500 KB |
Output is correct |
101 |
Correct |
43 ms |
43524 KB |
Output is correct |
102 |
Correct |
51 ms |
47764 KB |
Output is correct |
103 |
Correct |
168 ms |
87160 KB |
Output is correct |
104 |
Correct |
276 ms |
103508 KB |
Output is correct |
105 |
Correct |
323 ms |
120008 KB |
Output is correct |
106 |
Correct |
436 ms |
136996 KB |
Output is correct |
107 |
Correct |
553 ms |
152692 KB |
Output is correct |
108 |
Correct |
27 ms |
45044 KB |
Output is correct |
109 |
Correct |
33 ms |
45024 KB |
Output is correct |
110 |
Correct |
29 ms |
45044 KB |
Output is correct |
111 |
Correct |
22 ms |
37844 KB |
Output is correct |
112 |
Correct |
18 ms |
37844 KB |
Output is correct |
113 |
Correct |
27 ms |
44988 KB |
Output is correct |
114 |
Correct |
27 ms |
45100 KB |
Output is correct |
115 |
Correct |
27 ms |
45008 KB |
Output is correct |
116 |
Correct |
27 ms |
45060 KB |
Output is correct |
117 |
Correct |
19 ms |
37820 KB |
Output is correct |
118 |
Correct |
29 ms |
45004 KB |
Output is correct |
119 |
Correct |
19 ms |
38344 KB |
Output is correct |
120 |
Correct |
19 ms |
38208 KB |
Output is correct |
121 |
Correct |
235 ms |
106084 KB |
Output is correct |
122 |
Correct |
353 ms |
136088 KB |
Output is correct |
123 |
Correct |
356 ms |
135460 KB |
Output is correct |
124 |
Correct |
17 ms |
37844 KB |
Output is correct |
125 |
Correct |
27 ms |
44988 KB |
Output is correct |
126 |
Correct |
17 ms |
37860 KB |
Output is correct |
127 |
Correct |
410 ms |
171436 KB |
Output is correct |
128 |
Correct |
396 ms |
171816 KB |
Output is correct |
129 |
Correct |
382 ms |
174056 KB |
Output is correct |
130 |
Correct |
21 ms |
38680 KB |
Output is correct |
131 |
Correct |
20 ms |
39160 KB |
Output is correct |
132 |
Correct |
224 ms |
102108 KB |
Output is correct |
133 |
Correct |
368 ms |
135280 KB |
Output is correct |
134 |
Correct |
542 ms |
163836 KB |
Output is correct |
135 |
Correct |
667 ms |
175888 KB |
Output is correct |
136 |
Correct |
836 ms |
173616 KB |
Output is correct |
137 |
Correct |
642 ms |
178036 KB |
Output is correct |
138 |
Correct |
469 ms |
158276 KB |
Output is correct |
139 |
Correct |
510 ms |
148356 KB |
Output is correct |
140 |
Correct |
28 ms |
45000 KB |
Output is correct |
141 |
Correct |
80 ms |
60716 KB |
Output is correct |
142 |
Correct |
35 ms |
41676 KB |
Output is correct |
143 |
Correct |
43 ms |
45476 KB |
Output is correct |
144 |
Correct |
70 ms |
49856 KB |
Output is correct |
145 |
Correct |
237 ms |
100108 KB |
Output is correct |
146 |
Correct |
294 ms |
115584 KB |
Output is correct |
147 |
Correct |
368 ms |
131176 KB |
Output is correct |
148 |
Correct |
492 ms |
145620 KB |
Output is correct |
149 |
Correct |
562 ms |
159024 KB |
Output is correct |
150 |
Correct |
444 ms |
172060 KB |
Output is correct |
151 |
Correct |
436 ms |
178676 KB |
Output is correct |
152 |
Correct |
23 ms |
38868 KB |
Output is correct |
153 |
Correct |
21 ms |
39516 KB |
Output is correct |
154 |
Correct |
209 ms |
102104 KB |
Output is correct |
155 |
Correct |
339 ms |
132944 KB |
Output is correct |
156 |
Correct |
506 ms |
164480 KB |
Output is correct |
157 |
Correct |
29 ms |
45044 KB |
Output is correct |
158 |
Correct |
18 ms |
37864 KB |
Output is correct |
159 |
Correct |
29 ms |
44984 KB |
Output is correct |
160 |
Correct |
31 ms |
44972 KB |
Output is correct |
161 |
Correct |
535 ms |
174416 KB |
Output is correct |
162 |
Correct |
526 ms |
176280 KB |
Output is correct |
163 |
Correct |
491 ms |
158744 KB |
Output is correct |
164 |
Correct |
466 ms |
157964 KB |
Output is correct |
165 |
Correct |
547 ms |
169444 KB |
Output is correct |
166 |
Correct |
532 ms |
173492 KB |
Output is correct |
167 |
Incorrect |
96 ms |
66856 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |