#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;
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;
for(int i=0;i<n;i++){
curr=mp[(x[i]-2)*300000+y[i]];
if(curr!=0 and root(i)!=root(curr-1)){
curr--; mergev(i,curr);
add(x[i]-1,y[i]-1,br);
add(x[i]-1,y[i]+1,br+1);
ors.push_back({br,br+1});
br+=2;
}
}
for(int i=0;i<n;i++){
curr=mp[x[i]*300000+y[i]-2];
if(curr!=0 and root(i)!=root(curr-1)){
curr--; mergev(i,curr);
add(x[i]-1,y[i]-1,br);
add(x[i]+1,y[i]-1,br+1);
ors.push_back({br,br+1});
br+=2;
}
}
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;
for(int i=0;i<n;i++){
curr=mp[(x[i]-2)*300000+y[i]];
if(curr!=0 and root(i)!=root(curr-1)){
curr--; mergev(i,curr);
if(ans[br]==0 and ans[br+1]==0)return -1;
if(ans[br]==1){
sol.push_back({curr,i,x[i]-1,y[i]-1});
}else{
sol.push_back({curr,i,x[i]-1,y[i]+1});
}
br+=2;
}
}
for(int i=0;i<n;i++){
curr=mp[x[i]*300000+y[i]-2];
if(curr!=0 and root(i)!=root(curr-1)){
curr--; mergev(i,curr);
if(ans[br]==0 and ans[br+1]==0)return -1;
if(ans[br]==1){
sol.push_back({curr,i,x[i]-1,y[i]-1});
}else{
sol.push_back({curr,i,x[i]+1,y[i]-1});
}
br+=2;
}
}
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({4, 4, 6, 4, 2}, {4, 6, 4, 2, 4});
}
*/
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 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:105: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]
105 | for(int i=0;i<ors.size();i++){
| ~^~~~~~~~~~~
parks.cpp:142:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
142 | sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:142:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
142 | sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:144:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
144 | sol.push_back({curr,i,x[i]-1,y[i]+1});
parks.cpp:144:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) + 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
144 | sol.push_back({curr,i,x[i]-1,y[i]+1});
parks.cpp:158:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
158 | sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:158:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
158 | sol.push_back({curr,i,x[i]-1,y[i]-1});
parks.cpp:160:43: warning: narrowing conversion of '(x.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) + 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
160 | sol.push_back({curr,i,x[i]+1,y[i]-1});
parks.cpp:160:50: warning: narrowing conversion of '(y.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i)) - 1)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
160 | sol.push_back({curr,i,x[i]+1,y[i]-1});
parks.cpp:167:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
167 | for(int i=0;i<sol.size();i++){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
45012 KB |
Output is correct |
2 |
Correct |
26 ms |
45012 KB |
Output is correct |
3 |
Correct |
18 ms |
37792 KB |
Output is correct |
4 |
Correct |
26 ms |
44972 KB |
Output is correct |
5 |
Correct |
26 ms |
45008 KB |
Output is correct |
6 |
Correct |
18 ms |
37884 KB |
Output is correct |
7 |
Correct |
17 ms |
37852 KB |
Output is correct |
8 |
Correct |
23 ms |
37972 KB |
Output is correct |
9 |
Correct |
255 ms |
95788 KB |
Output is correct |
10 |
Correct |
41 ms |
49484 KB |
Output is correct |
11 |
Correct |
80 ms |
70808 KB |
Output is correct |
12 |
Correct |
42 ms |
51996 KB |
Output is correct |
13 |
Correct |
43 ms |
52672 KB |
Output is correct |
14 |
Correct |
23 ms |
38100 KB |
Output is correct |
15 |
Correct |
20 ms |
38460 KB |
Output is correct |
16 |
Correct |
205 ms |
95656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
45012 KB |
Output is correct |
2 |
Correct |
26 ms |
45012 KB |
Output is correct |
3 |
Correct |
18 ms |
37792 KB |
Output is correct |
4 |
Correct |
26 ms |
44972 KB |
Output is correct |
5 |
Correct |
26 ms |
45008 KB |
Output is correct |
6 |
Correct |
18 ms |
37884 KB |
Output is correct |
7 |
Correct |
17 ms |
37852 KB |
Output is correct |
8 |
Correct |
23 ms |
37972 KB |
Output is correct |
9 |
Correct |
255 ms |
95788 KB |
Output is correct |
10 |
Correct |
41 ms |
49484 KB |
Output is correct |
11 |
Correct |
80 ms |
70808 KB |
Output is correct |
12 |
Correct |
42 ms |
51996 KB |
Output is correct |
13 |
Correct |
43 ms |
52672 KB |
Output is correct |
14 |
Correct |
23 ms |
38100 KB |
Output is correct |
15 |
Correct |
20 ms |
38460 KB |
Output is correct |
16 |
Correct |
205 ms |
95656 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45044 KB |
Output is correct |
19 |
Correct |
28 ms |
45080 KB |
Output is correct |
20 |
Correct |
30 ms |
44968 KB |
Output is correct |
21 |
Correct |
19 ms |
37844 KB |
Output is correct |
22 |
Correct |
29 ms |
45004 KB |
Output is correct |
23 |
Correct |
808 ms |
156812 KB |
Output is correct |
24 |
Correct |
29 ms |
45012 KB |
Output is correct |
25 |
Correct |
31 ms |
45684 KB |
Output is correct |
26 |
Correct |
27 ms |
38532 KB |
Output is correct |
27 |
Correct |
22 ms |
38708 KB |
Output is correct |
28 |
Correct |
250 ms |
86484 KB |
Output is correct |
29 |
Correct |
395 ms |
111608 KB |
Output is correct |
30 |
Correct |
550 ms |
133148 KB |
Output is correct |
31 |
Correct |
809 ms |
155912 KB |
Output is correct |
32 |
Correct |
28 ms |
45092 KB |
Output is correct |
33 |
Correct |
27 ms |
45040 KB |
Output is correct |
34 |
Correct |
28 ms |
45052 KB |
Output is correct |
35 |
Correct |
17 ms |
37844 KB |
Output is correct |
36 |
Correct |
21 ms |
37828 KB |
Output is correct |
37 |
Correct |
28 ms |
45012 KB |
Output is correct |
38 |
Correct |
34 ms |
45000 KB |
Output is correct |
39 |
Correct |
28 ms |
45040 KB |
Output is correct |
40 |
Correct |
28 ms |
45028 KB |
Output is correct |
41 |
Correct |
19 ms |
37884 KB |
Output is correct |
42 |
Correct |
28 ms |
45000 KB |
Output is correct |
43 |
Correct |
20 ms |
38356 KB |
Output is correct |
44 |
Correct |
22 ms |
38668 KB |
Output is correct |
45 |
Correct |
252 ms |
98024 KB |
Output is correct |
46 |
Correct |
488 ms |
123604 KB |
Output is correct |
47 |
Correct |
444 ms |
123632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
45012 KB |
Output is correct |
2 |
Correct |
26 ms |
45012 KB |
Output is correct |
3 |
Correct |
18 ms |
37792 KB |
Output is correct |
4 |
Correct |
26 ms |
44972 KB |
Output is correct |
5 |
Correct |
26 ms |
45008 KB |
Output is correct |
6 |
Correct |
18 ms |
37884 KB |
Output is correct |
7 |
Correct |
17 ms |
37852 KB |
Output is correct |
8 |
Correct |
23 ms |
37972 KB |
Output is correct |
9 |
Correct |
255 ms |
95788 KB |
Output is correct |
10 |
Correct |
41 ms |
49484 KB |
Output is correct |
11 |
Correct |
80 ms |
70808 KB |
Output is correct |
12 |
Correct |
42 ms |
51996 KB |
Output is correct |
13 |
Correct |
43 ms |
52672 KB |
Output is correct |
14 |
Correct |
23 ms |
38100 KB |
Output is correct |
15 |
Correct |
20 ms |
38460 KB |
Output is correct |
16 |
Correct |
205 ms |
95656 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45044 KB |
Output is correct |
19 |
Correct |
28 ms |
45080 KB |
Output is correct |
20 |
Correct |
30 ms |
44968 KB |
Output is correct |
21 |
Correct |
19 ms |
37844 KB |
Output is correct |
22 |
Correct |
29 ms |
45004 KB |
Output is correct |
23 |
Correct |
808 ms |
156812 KB |
Output is correct |
24 |
Correct |
29 ms |
45012 KB |
Output is correct |
25 |
Correct |
31 ms |
45684 KB |
Output is correct |
26 |
Correct |
27 ms |
38532 KB |
Output is correct |
27 |
Correct |
22 ms |
38708 KB |
Output is correct |
28 |
Correct |
250 ms |
86484 KB |
Output is correct |
29 |
Correct |
395 ms |
111608 KB |
Output is correct |
30 |
Correct |
550 ms |
133148 KB |
Output is correct |
31 |
Correct |
809 ms |
155912 KB |
Output is correct |
32 |
Correct |
28 ms |
45092 KB |
Output is correct |
33 |
Correct |
27 ms |
45040 KB |
Output is correct |
34 |
Correct |
28 ms |
45052 KB |
Output is correct |
35 |
Correct |
17 ms |
37844 KB |
Output is correct |
36 |
Correct |
21 ms |
37828 KB |
Output is correct |
37 |
Correct |
28 ms |
45012 KB |
Output is correct |
38 |
Correct |
34 ms |
45000 KB |
Output is correct |
39 |
Correct |
28 ms |
45040 KB |
Output is correct |
40 |
Correct |
28 ms |
45028 KB |
Output is correct |
41 |
Correct |
19 ms |
37884 KB |
Output is correct |
42 |
Correct |
28 ms |
45000 KB |
Output is correct |
43 |
Correct |
20 ms |
38356 KB |
Output is correct |
44 |
Correct |
22 ms |
38668 KB |
Output is correct |
45 |
Correct |
252 ms |
98024 KB |
Output is correct |
46 |
Correct |
488 ms |
123604 KB |
Output is correct |
47 |
Correct |
444 ms |
123632 KB |
Output is correct |
48 |
Correct |
28 ms |
45004 KB |
Output is correct |
49 |
Correct |
27 ms |
45080 KB |
Output is correct |
50 |
Correct |
28 ms |
45008 KB |
Output is correct |
51 |
Correct |
37 ms |
45088 KB |
Output is correct |
52 |
Correct |
29 ms |
44980 KB |
Output is correct |
53 |
Correct |
32 ms |
45004 KB |
Output is correct |
54 |
Correct |
29 ms |
45048 KB |
Output is correct |
55 |
Incorrect |
863 ms |
158464 KB |
Solution announced impossible, but it is possible. |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
45012 KB |
Output is correct |
2 |
Correct |
26 ms |
45012 KB |
Output is correct |
3 |
Correct |
18 ms |
37792 KB |
Output is correct |
4 |
Correct |
26 ms |
44972 KB |
Output is correct |
5 |
Correct |
26 ms |
45008 KB |
Output is correct |
6 |
Correct |
18 ms |
37884 KB |
Output is correct |
7 |
Correct |
17 ms |
37852 KB |
Output is correct |
8 |
Correct |
23 ms |
37972 KB |
Output is correct |
9 |
Correct |
255 ms |
95788 KB |
Output is correct |
10 |
Correct |
41 ms |
49484 KB |
Output is correct |
11 |
Correct |
80 ms |
70808 KB |
Output is correct |
12 |
Correct |
42 ms |
51996 KB |
Output is correct |
13 |
Correct |
43 ms |
52672 KB |
Output is correct |
14 |
Correct |
23 ms |
38100 KB |
Output is correct |
15 |
Correct |
20 ms |
38460 KB |
Output is correct |
16 |
Correct |
205 ms |
95656 KB |
Output is correct |
17 |
Correct |
28 ms |
45000 KB |
Output is correct |
18 |
Correct |
29 ms |
45012 KB |
Output is correct |
19 |
Correct |
19 ms |
37884 KB |
Output is correct |
20 |
Correct |
873 ms |
173068 KB |
Output is correct |
21 |
Correct |
883 ms |
165552 KB |
Output is correct |
22 |
Correct |
890 ms |
161036 KB |
Output is correct |
23 |
Correct |
476 ms |
131352 KB |
Output is correct |
24 |
Correct |
140 ms |
71240 KB |
Output is correct |
25 |
Correct |
401 ms |
104516 KB |
Output is correct |
26 |
Correct |
475 ms |
103388 KB |
Output is correct |
27 |
Correct |
641 ms |
151320 KB |
Output is correct |
28 |
Correct |
632 ms |
151344 KB |
Output is correct |
29 |
Correct |
605 ms |
151216 KB |
Output is correct |
30 |
Correct |
583 ms |
151284 KB |
Output is correct |
31 |
Correct |
34 ms |
45004 KB |
Output is correct |
32 |
Correct |
52 ms |
52192 KB |
Output is correct |
33 |
Correct |
62 ms |
54672 KB |
Output is correct |
34 |
Correct |
873 ms |
172256 KB |
Output is correct |
35 |
Correct |
25 ms |
40448 KB |
Output is correct |
36 |
Correct |
60 ms |
49416 KB |
Output is correct |
37 |
Correct |
156 ms |
61048 KB |
Output is correct |
38 |
Correct |
228 ms |
87564 KB |
Output is correct |
39 |
Correct |
374 ms |
104248 KB |
Output is correct |
40 |
Correct |
494 ms |
120572 KB |
Output is correct |
41 |
Correct |
751 ms |
137412 KB |
Output is correct |
42 |
Correct |
902 ms |
153168 KB |
Output is correct |
43 |
Correct |
28 ms |
45012 KB |
Output is correct |
44 |
Correct |
29 ms |
45180 KB |
Output is correct |
45 |
Correct |
28 ms |
45040 KB |
Output is correct |
46 |
Correct |
21 ms |
37780 KB |
Output is correct |
47 |
Correct |
18 ms |
37868 KB |
Output is correct |
48 |
Correct |
29 ms |
45004 KB |
Output is correct |
49 |
Correct |
28 ms |
45092 KB |
Output is correct |
50 |
Correct |
29 ms |
45040 KB |
Output is correct |
51 |
Correct |
29 ms |
45044 KB |
Output is correct |
52 |
Correct |
19 ms |
37824 KB |
Output is correct |
53 |
Correct |
28 ms |
44968 KB |
Output is correct |
54 |
Correct |
19 ms |
38404 KB |
Output is correct |
55 |
Correct |
21 ms |
38612 KB |
Output is correct |
56 |
Correct |
260 ms |
97596 KB |
Output is correct |
57 |
Correct |
420 ms |
123268 KB |
Output is correct |
58 |
Correct |
452 ms |
123200 KB |
Output is correct |
59 |
Correct |
19 ms |
37844 KB |
Output is correct |
60 |
Correct |
29 ms |
44964 KB |
Output is correct |
61 |
Correct |
19 ms |
37780 KB |
Output is correct |
62 |
Correct |
489 ms |
151292 KB |
Output is correct |
63 |
Correct |
482 ms |
151236 KB |
Output is correct |
64 |
Correct |
604 ms |
150796 KB |
Output is correct |
65 |
Correct |
21 ms |
38932 KB |
Output is correct |
66 |
Correct |
30 ms |
39920 KB |
Output is correct |
67 |
Correct |
271 ms |
97628 KB |
Output is correct |
68 |
Correct |
481 ms |
125844 KB |
Output is correct |
69 |
Correct |
767 ms |
154496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
45012 KB |
Output is correct |
2 |
Correct |
26 ms |
45012 KB |
Output is correct |
3 |
Correct |
18 ms |
37792 KB |
Output is correct |
4 |
Correct |
26 ms |
44972 KB |
Output is correct |
5 |
Correct |
26 ms |
45008 KB |
Output is correct |
6 |
Correct |
18 ms |
37884 KB |
Output is correct |
7 |
Correct |
17 ms |
37852 KB |
Output is correct |
8 |
Correct |
23 ms |
37972 KB |
Output is correct |
9 |
Correct |
255 ms |
95788 KB |
Output is correct |
10 |
Correct |
41 ms |
49484 KB |
Output is correct |
11 |
Correct |
80 ms |
70808 KB |
Output is correct |
12 |
Correct |
42 ms |
51996 KB |
Output is correct |
13 |
Correct |
43 ms |
52672 KB |
Output is correct |
14 |
Correct |
23 ms |
38100 KB |
Output is correct |
15 |
Correct |
20 ms |
38460 KB |
Output is correct |
16 |
Correct |
205 ms |
95656 KB |
Output is correct |
17 |
Correct |
620 ms |
150844 KB |
Output is correct |
18 |
Correct |
704 ms |
151776 KB |
Output is correct |
19 |
Correct |
907 ms |
167124 KB |
Output is correct |
20 |
Correct |
748 ms |
146828 KB |
Output is correct |
21 |
Correct |
652 ms |
135048 KB |
Output is correct |
22 |
Correct |
28 ms |
45012 KB |
Output is correct |
23 |
Correct |
94 ms |
60468 KB |
Output is correct |
24 |
Correct |
32 ms |
42928 KB |
Output is correct |
25 |
Correct |
73 ms |
55256 KB |
Output is correct |
26 |
Correct |
174 ms |
66948 KB |
Output is correct |
27 |
Correct |
292 ms |
95984 KB |
Output is correct |
28 |
Correct |
422 ms |
110360 KB |
Output is correct |
29 |
Correct |
599 ms |
125932 KB |
Output is correct |
30 |
Correct |
666 ms |
138204 KB |
Output is correct |
31 |
Correct |
865 ms |
151420 KB |
Output is correct |
32 |
Correct |
658 ms |
149588 KB |
Output is correct |
33 |
Correct |
469 ms |
151212 KB |
Output is correct |
34 |
Correct |
22 ms |
39124 KB |
Output is correct |
35 |
Correct |
28 ms |
40084 KB |
Output is correct |
36 |
Correct |
264 ms |
95996 KB |
Output is correct |
37 |
Correct |
486 ms |
125464 KB |
Output is correct |
38 |
Correct |
777 ms |
151176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
45012 KB |
Output is correct |
2 |
Correct |
26 ms |
45012 KB |
Output is correct |
3 |
Correct |
18 ms |
37792 KB |
Output is correct |
4 |
Correct |
26 ms |
44972 KB |
Output is correct |
5 |
Correct |
26 ms |
45008 KB |
Output is correct |
6 |
Correct |
18 ms |
37884 KB |
Output is correct |
7 |
Correct |
17 ms |
37852 KB |
Output is correct |
8 |
Correct |
23 ms |
37972 KB |
Output is correct |
9 |
Correct |
255 ms |
95788 KB |
Output is correct |
10 |
Correct |
41 ms |
49484 KB |
Output is correct |
11 |
Correct |
80 ms |
70808 KB |
Output is correct |
12 |
Correct |
42 ms |
51996 KB |
Output is correct |
13 |
Correct |
43 ms |
52672 KB |
Output is correct |
14 |
Correct |
23 ms |
38100 KB |
Output is correct |
15 |
Correct |
20 ms |
38460 KB |
Output is correct |
16 |
Correct |
205 ms |
95656 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45044 KB |
Output is correct |
19 |
Correct |
28 ms |
45080 KB |
Output is correct |
20 |
Correct |
30 ms |
44968 KB |
Output is correct |
21 |
Correct |
19 ms |
37844 KB |
Output is correct |
22 |
Correct |
29 ms |
45004 KB |
Output is correct |
23 |
Correct |
808 ms |
156812 KB |
Output is correct |
24 |
Correct |
29 ms |
45012 KB |
Output is correct |
25 |
Correct |
31 ms |
45684 KB |
Output is correct |
26 |
Correct |
27 ms |
38532 KB |
Output is correct |
27 |
Correct |
22 ms |
38708 KB |
Output is correct |
28 |
Correct |
250 ms |
86484 KB |
Output is correct |
29 |
Correct |
395 ms |
111608 KB |
Output is correct |
30 |
Correct |
550 ms |
133148 KB |
Output is correct |
31 |
Correct |
809 ms |
155912 KB |
Output is correct |
32 |
Correct |
28 ms |
45092 KB |
Output is correct |
33 |
Correct |
27 ms |
45040 KB |
Output is correct |
34 |
Correct |
28 ms |
45052 KB |
Output is correct |
35 |
Correct |
17 ms |
37844 KB |
Output is correct |
36 |
Correct |
21 ms |
37828 KB |
Output is correct |
37 |
Correct |
28 ms |
45012 KB |
Output is correct |
38 |
Correct |
34 ms |
45000 KB |
Output is correct |
39 |
Correct |
28 ms |
45040 KB |
Output is correct |
40 |
Correct |
28 ms |
45028 KB |
Output is correct |
41 |
Correct |
19 ms |
37884 KB |
Output is correct |
42 |
Correct |
28 ms |
45000 KB |
Output is correct |
43 |
Correct |
20 ms |
38356 KB |
Output is correct |
44 |
Correct |
22 ms |
38668 KB |
Output is correct |
45 |
Correct |
252 ms |
98024 KB |
Output is correct |
46 |
Correct |
488 ms |
123604 KB |
Output is correct |
47 |
Correct |
444 ms |
123632 KB |
Output is correct |
48 |
Correct |
28 ms |
45004 KB |
Output is correct |
49 |
Correct |
27 ms |
45080 KB |
Output is correct |
50 |
Correct |
28 ms |
45008 KB |
Output is correct |
51 |
Correct |
37 ms |
45088 KB |
Output is correct |
52 |
Correct |
29 ms |
44980 KB |
Output is correct |
53 |
Correct |
32 ms |
45004 KB |
Output is correct |
54 |
Correct |
29 ms |
45048 KB |
Output is correct |
55 |
Incorrect |
863 ms |
158464 KB |
Solution announced impossible, but it is possible. |
56 |
Halted |
0 ms |
0 KB |
- |