#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];
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;
map< pair<int,int>, int> mp;
map< pair<int,int>, vector<int> > bro;
int op(int x){
if(x<400000)return x+400000;
return x-400000;
}
void add(int x,int y,int z){
for(int i=0;i<bro[{x,y}].size();i++){
ors.push_back({op(bro[{x,y}][i]),op(z)});
}
bro[{x,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){
dsu[root(x)]=root(y);
}
int construct_roads(vector<int> x,vector<int> y){
n=int(x.size());
for(int i=0;i<n;i++){
dsu[i]=i;
mp[{x[i],y[i]}]=i+1;
}
br=0;
for(int i=0;i<n;i++){
curr=mp[{x[i],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;
}
}
for(int i=0;i<n;i++){
curr=mp[{x[i]-2,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;
}
}
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;
br=0;
for(int i=0;i<n;i++){
curr=mp[{x[i],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<n;i++){
curr=mp[{x[i]-2,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<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(int, 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,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:99: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]
99 | for(int i=0;i<ors.size();i++){
| ~^~~~~~~~~~~
parks.cpp:159:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bench>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
159 | for(int i=0;i<sol.size();i++){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45016 KB |
Output is correct |
3 |
Correct |
18 ms |
37800 KB |
Output is correct |
4 |
Correct |
27 ms |
45048 KB |
Output is correct |
5 |
Correct |
28 ms |
45000 KB |
Output is correct |
6 |
Correct |
18 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37936 KB |
Output is correct |
9 |
Correct |
400 ms |
100732 KB |
Output is correct |
10 |
Correct |
45 ms |
50212 KB |
Output is correct |
11 |
Correct |
141 ms |
73712 KB |
Output is correct |
12 |
Correct |
53 ms |
52896 KB |
Output is correct |
13 |
Correct |
89 ms |
54236 KB |
Output is correct |
14 |
Correct |
19 ms |
38252 KB |
Output is correct |
15 |
Correct |
24 ms |
38520 KB |
Output is correct |
16 |
Correct |
431 ms |
100736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45016 KB |
Output is correct |
3 |
Correct |
18 ms |
37800 KB |
Output is correct |
4 |
Correct |
27 ms |
45048 KB |
Output is correct |
5 |
Correct |
28 ms |
45000 KB |
Output is correct |
6 |
Correct |
18 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37936 KB |
Output is correct |
9 |
Correct |
400 ms |
100732 KB |
Output is correct |
10 |
Correct |
45 ms |
50212 KB |
Output is correct |
11 |
Correct |
141 ms |
73712 KB |
Output is correct |
12 |
Correct |
53 ms |
52896 KB |
Output is correct |
13 |
Correct |
89 ms |
54236 KB |
Output is correct |
14 |
Correct |
19 ms |
38252 KB |
Output is correct |
15 |
Correct |
24 ms |
38520 KB |
Output is correct |
16 |
Correct |
431 ms |
100736 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45036 KB |
Output is correct |
19 |
Correct |
32 ms |
45068 KB |
Output is correct |
20 |
Correct |
28 ms |
45012 KB |
Output is correct |
21 |
Correct |
18 ms |
37844 KB |
Output is correct |
22 |
Correct |
27 ms |
45044 KB |
Output is correct |
23 |
Correct |
1158 ms |
156672 KB |
Output is correct |
24 |
Correct |
29 ms |
45012 KB |
Output is correct |
25 |
Correct |
31 ms |
45620 KB |
Output is correct |
26 |
Correct |
21 ms |
38764 KB |
Output is correct |
27 |
Correct |
28 ms |
38996 KB |
Output is correct |
28 |
Correct |
350 ms |
87984 KB |
Output is correct |
29 |
Correct |
565 ms |
110188 KB |
Output is correct |
30 |
Correct |
845 ms |
133488 KB |
Output is correct |
31 |
Correct |
1131 ms |
156496 KB |
Output is correct |
32 |
Correct |
28 ms |
45000 KB |
Output is correct |
33 |
Correct |
27 ms |
45060 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 |
37844 KB |
Output is correct |
37 |
Correct |
28 ms |
45012 KB |
Output is correct |
38 |
Correct |
28 ms |
45012 KB |
Output is correct |
39 |
Correct |
28 ms |
45036 KB |
Output is correct |
40 |
Correct |
29 ms |
45064 KB |
Output is correct |
41 |
Correct |
21 ms |
37844 KB |
Output is correct |
42 |
Correct |
33 ms |
45064 KB |
Output is correct |
43 |
Correct |
21 ms |
38484 KB |
Output is correct |
44 |
Correct |
23 ms |
38748 KB |
Output is correct |
45 |
Correct |
543 ms |
101172 KB |
Output is correct |
46 |
Correct |
795 ms |
128748 KB |
Output is correct |
47 |
Correct |
795 ms |
128844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45016 KB |
Output is correct |
3 |
Correct |
18 ms |
37800 KB |
Output is correct |
4 |
Correct |
27 ms |
45048 KB |
Output is correct |
5 |
Correct |
28 ms |
45000 KB |
Output is correct |
6 |
Correct |
18 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37936 KB |
Output is correct |
9 |
Correct |
400 ms |
100732 KB |
Output is correct |
10 |
Correct |
45 ms |
50212 KB |
Output is correct |
11 |
Correct |
141 ms |
73712 KB |
Output is correct |
12 |
Correct |
53 ms |
52896 KB |
Output is correct |
13 |
Correct |
89 ms |
54236 KB |
Output is correct |
14 |
Correct |
19 ms |
38252 KB |
Output is correct |
15 |
Correct |
24 ms |
38520 KB |
Output is correct |
16 |
Correct |
431 ms |
100736 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45036 KB |
Output is correct |
19 |
Correct |
32 ms |
45068 KB |
Output is correct |
20 |
Correct |
28 ms |
45012 KB |
Output is correct |
21 |
Correct |
18 ms |
37844 KB |
Output is correct |
22 |
Correct |
27 ms |
45044 KB |
Output is correct |
23 |
Correct |
1158 ms |
156672 KB |
Output is correct |
24 |
Correct |
29 ms |
45012 KB |
Output is correct |
25 |
Correct |
31 ms |
45620 KB |
Output is correct |
26 |
Correct |
21 ms |
38764 KB |
Output is correct |
27 |
Correct |
28 ms |
38996 KB |
Output is correct |
28 |
Correct |
350 ms |
87984 KB |
Output is correct |
29 |
Correct |
565 ms |
110188 KB |
Output is correct |
30 |
Correct |
845 ms |
133488 KB |
Output is correct |
31 |
Correct |
1131 ms |
156496 KB |
Output is correct |
32 |
Correct |
28 ms |
45000 KB |
Output is correct |
33 |
Correct |
27 ms |
45060 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 |
37844 KB |
Output is correct |
37 |
Correct |
28 ms |
45012 KB |
Output is correct |
38 |
Correct |
28 ms |
45012 KB |
Output is correct |
39 |
Correct |
28 ms |
45036 KB |
Output is correct |
40 |
Correct |
29 ms |
45064 KB |
Output is correct |
41 |
Correct |
21 ms |
37844 KB |
Output is correct |
42 |
Correct |
33 ms |
45064 KB |
Output is correct |
43 |
Correct |
21 ms |
38484 KB |
Output is correct |
44 |
Correct |
23 ms |
38748 KB |
Output is correct |
45 |
Correct |
543 ms |
101172 KB |
Output is correct |
46 |
Correct |
795 ms |
128748 KB |
Output is correct |
47 |
Correct |
795 ms |
128844 KB |
Output is correct |
48 |
Correct |
34 ms |
45060 KB |
Output is correct |
49 |
Correct |
26 ms |
45068 KB |
Output is correct |
50 |
Correct |
27 ms |
45092 KB |
Output is correct |
51 |
Correct |
28 ms |
45004 KB |
Output is correct |
52 |
Correct |
29 ms |
45004 KB |
Output is correct |
53 |
Correct |
28 ms |
45044 KB |
Output is correct |
54 |
Correct |
29 ms |
45012 KB |
Output is correct |
55 |
Correct |
1181 ms |
155128 KB |
Output is correct |
56 |
Correct |
28 ms |
45012 KB |
Output is correct |
57 |
Correct |
38 ms |
45928 KB |
Output is correct |
58 |
Correct |
42 ms |
48060 KB |
Output is correct |
59 |
Correct |
33 ms |
40480 KB |
Output is correct |
60 |
Correct |
452 ms |
98800 KB |
Output is correct |
61 |
Correct |
697 ms |
119844 KB |
Output is correct |
62 |
Correct |
902 ms |
137164 KB |
Output is correct |
63 |
Correct |
1166 ms |
156740 KB |
Output is correct |
64 |
Correct |
17 ms |
37892 KB |
Output is correct |
65 |
Correct |
27 ms |
45024 KB |
Output is correct |
66 |
Correct |
18 ms |
37844 KB |
Output is correct |
67 |
Correct |
968 ms |
161636 KB |
Output is correct |
68 |
Correct |
947 ms |
161608 KB |
Output is correct |
69 |
Correct |
996 ms |
161080 KB |
Output is correct |
70 |
Correct |
24 ms |
38996 KB |
Output is correct |
71 |
Correct |
29 ms |
40204 KB |
Output is correct |
72 |
Correct |
493 ms |
101568 KB |
Output is correct |
73 |
Correct |
876 ms |
132532 KB |
Output is correct |
74 |
Correct |
1317 ms |
162380 KB |
Output is correct |
75 |
Correct |
1146 ms |
158692 KB |
Output is correct |
76 |
Correct |
946 ms |
161684 KB |
Output is correct |
77 |
Correct |
27 ms |
39380 KB |
Output is correct |
78 |
Correct |
31 ms |
40572 KB |
Output is correct |
79 |
Correct |
470 ms |
100852 KB |
Output is correct |
80 |
Correct |
850 ms |
131360 KB |
Output is correct |
81 |
Correct |
1228 ms |
160652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45016 KB |
Output is correct |
3 |
Correct |
18 ms |
37800 KB |
Output is correct |
4 |
Correct |
27 ms |
45048 KB |
Output is correct |
5 |
Correct |
28 ms |
45000 KB |
Output is correct |
6 |
Correct |
18 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37936 KB |
Output is correct |
9 |
Correct |
400 ms |
100732 KB |
Output is correct |
10 |
Correct |
45 ms |
50212 KB |
Output is correct |
11 |
Correct |
141 ms |
73712 KB |
Output is correct |
12 |
Correct |
53 ms |
52896 KB |
Output is correct |
13 |
Correct |
89 ms |
54236 KB |
Output is correct |
14 |
Correct |
19 ms |
38252 KB |
Output is correct |
15 |
Correct |
24 ms |
38520 KB |
Output is correct |
16 |
Correct |
431 ms |
100736 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45012 KB |
Output is correct |
19 |
Correct |
18 ms |
37860 KB |
Output is correct |
20 |
Correct |
1259 ms |
178148 KB |
Output is correct |
21 |
Correct |
1411 ms |
173932 KB |
Output is correct |
22 |
Correct |
1276 ms |
166288 KB |
Output is correct |
23 |
Correct |
830 ms |
142720 KB |
Output is correct |
24 |
Correct |
323 ms |
79320 KB |
Output is correct |
25 |
Correct |
664 ms |
112156 KB |
Output is correct |
26 |
Correct |
659 ms |
112180 KB |
Output is correct |
27 |
Correct |
967 ms |
160160 KB |
Output is correct |
28 |
Correct |
1008 ms |
160248 KB |
Output is correct |
29 |
Correct |
1018 ms |
160416 KB |
Output is correct |
30 |
Correct |
997 ms |
160108 KB |
Output is correct |
31 |
Correct |
28 ms |
45012 KB |
Output is correct |
32 |
Correct |
72 ms |
52492 KB |
Output is correct |
33 |
Correct |
132 ms |
58528 KB |
Output is correct |
34 |
Correct |
1379 ms |
181392 KB |
Output is correct |
35 |
Correct |
36 ms |
40640 KB |
Output is correct |
36 |
Correct |
122 ms |
51212 KB |
Output is correct |
37 |
Correct |
285 ms |
64660 KB |
Output is correct |
38 |
Correct |
393 ms |
89664 KB |
Output is correct |
39 |
Correct |
589 ms |
106784 KB |
Output is correct |
40 |
Correct |
839 ms |
125396 KB |
Output is correct |
41 |
Correct |
1073 ms |
142792 KB |
Output is correct |
42 |
Correct |
1346 ms |
160620 KB |
Output is correct |
43 |
Correct |
29 ms |
45088 KB |
Output is correct |
44 |
Correct |
30 ms |
45044 KB |
Output is correct |
45 |
Correct |
29 ms |
45028 KB |
Output is correct |
46 |
Correct |
19 ms |
37792 KB |
Output is correct |
47 |
Correct |
19 ms |
37828 KB |
Output is correct |
48 |
Correct |
29 ms |
45012 KB |
Output is correct |
49 |
Correct |
28 ms |
45004 KB |
Output is correct |
50 |
Correct |
29 ms |
45044 KB |
Output is correct |
51 |
Correct |
29 ms |
45036 KB |
Output is correct |
52 |
Correct |
19 ms |
37784 KB |
Output is correct |
53 |
Correct |
32 ms |
44996 KB |
Output is correct |
54 |
Correct |
21 ms |
38484 KB |
Output is correct |
55 |
Correct |
26 ms |
38672 KB |
Output is correct |
56 |
Correct |
483 ms |
101284 KB |
Output is correct |
57 |
Correct |
805 ms |
128968 KB |
Output is correct |
58 |
Correct |
832 ms |
128768 KB |
Output is correct |
59 |
Correct |
18 ms |
37776 KB |
Output is correct |
60 |
Correct |
28 ms |
45036 KB |
Output is correct |
61 |
Correct |
18 ms |
37792 KB |
Output is correct |
62 |
Correct |
996 ms |
160200 KB |
Output is correct |
63 |
Correct |
963 ms |
160312 KB |
Output is correct |
64 |
Correct |
943 ms |
159596 KB |
Output is correct |
65 |
Correct |
26 ms |
38940 KB |
Output is correct |
66 |
Correct |
29 ms |
40148 KB |
Output is correct |
67 |
Correct |
495 ms |
100828 KB |
Output is correct |
68 |
Correct |
932 ms |
131252 KB |
Output is correct |
69 |
Correct |
1261 ms |
160916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45016 KB |
Output is correct |
3 |
Correct |
18 ms |
37800 KB |
Output is correct |
4 |
Correct |
27 ms |
45048 KB |
Output is correct |
5 |
Correct |
28 ms |
45000 KB |
Output is correct |
6 |
Correct |
18 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37936 KB |
Output is correct |
9 |
Correct |
400 ms |
100732 KB |
Output is correct |
10 |
Correct |
45 ms |
50212 KB |
Output is correct |
11 |
Correct |
141 ms |
73712 KB |
Output is correct |
12 |
Correct |
53 ms |
52896 KB |
Output is correct |
13 |
Correct |
89 ms |
54236 KB |
Output is correct |
14 |
Correct |
19 ms |
38252 KB |
Output is correct |
15 |
Correct |
24 ms |
38520 KB |
Output is correct |
16 |
Correct |
431 ms |
100736 KB |
Output is correct |
17 |
Correct |
1020 ms |
160688 KB |
Output is correct |
18 |
Correct |
1049 ms |
160956 KB |
Output is correct |
19 |
Correct |
1369 ms |
179232 KB |
Output is correct |
20 |
Correct |
1168 ms |
153028 KB |
Output is correct |
21 |
Correct |
1006 ms |
144360 KB |
Output is correct |
22 |
Correct |
32 ms |
44984 KB |
Output is correct |
23 |
Correct |
127 ms |
61248 KB |
Output is correct |
24 |
Correct |
52 ms |
43324 KB |
Output is correct |
25 |
Correct |
186 ms |
56456 KB |
Output is correct |
26 |
Correct |
348 ms |
69724 KB |
Output is correct |
27 |
Correct |
525 ms |
99508 KB |
Output is correct |
28 |
Correct |
728 ms |
113796 KB |
Output is correct |
29 |
Correct |
890 ms |
129376 KB |
Output is correct |
30 |
Correct |
1081 ms |
143316 KB |
Output is correct |
31 |
Correct |
1353 ms |
158124 KB |
Output is correct |
32 |
Correct |
1151 ms |
157260 KB |
Output is correct |
33 |
Correct |
980 ms |
160220 KB |
Output is correct |
34 |
Correct |
25 ms |
39360 KB |
Output is correct |
35 |
Correct |
30 ms |
40524 KB |
Output is correct |
36 |
Correct |
472 ms |
100048 KB |
Output is correct |
37 |
Correct |
850 ms |
130076 KB |
Output is correct |
38 |
Correct |
1262 ms |
159252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
45012 KB |
Output is correct |
2 |
Correct |
27 ms |
45016 KB |
Output is correct |
3 |
Correct |
18 ms |
37800 KB |
Output is correct |
4 |
Correct |
27 ms |
45048 KB |
Output is correct |
5 |
Correct |
28 ms |
45000 KB |
Output is correct |
6 |
Correct |
18 ms |
37844 KB |
Output is correct |
7 |
Correct |
18 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37936 KB |
Output is correct |
9 |
Correct |
400 ms |
100732 KB |
Output is correct |
10 |
Correct |
45 ms |
50212 KB |
Output is correct |
11 |
Correct |
141 ms |
73712 KB |
Output is correct |
12 |
Correct |
53 ms |
52896 KB |
Output is correct |
13 |
Correct |
89 ms |
54236 KB |
Output is correct |
14 |
Correct |
19 ms |
38252 KB |
Output is correct |
15 |
Correct |
24 ms |
38520 KB |
Output is correct |
16 |
Correct |
431 ms |
100736 KB |
Output is correct |
17 |
Correct |
27 ms |
45000 KB |
Output is correct |
18 |
Correct |
27 ms |
45036 KB |
Output is correct |
19 |
Correct |
32 ms |
45068 KB |
Output is correct |
20 |
Correct |
28 ms |
45012 KB |
Output is correct |
21 |
Correct |
18 ms |
37844 KB |
Output is correct |
22 |
Correct |
27 ms |
45044 KB |
Output is correct |
23 |
Correct |
1158 ms |
156672 KB |
Output is correct |
24 |
Correct |
29 ms |
45012 KB |
Output is correct |
25 |
Correct |
31 ms |
45620 KB |
Output is correct |
26 |
Correct |
21 ms |
38764 KB |
Output is correct |
27 |
Correct |
28 ms |
38996 KB |
Output is correct |
28 |
Correct |
350 ms |
87984 KB |
Output is correct |
29 |
Correct |
565 ms |
110188 KB |
Output is correct |
30 |
Correct |
845 ms |
133488 KB |
Output is correct |
31 |
Correct |
1131 ms |
156496 KB |
Output is correct |
32 |
Correct |
28 ms |
45000 KB |
Output is correct |
33 |
Correct |
27 ms |
45060 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 |
37844 KB |
Output is correct |
37 |
Correct |
28 ms |
45012 KB |
Output is correct |
38 |
Correct |
28 ms |
45012 KB |
Output is correct |
39 |
Correct |
28 ms |
45036 KB |
Output is correct |
40 |
Correct |
29 ms |
45064 KB |
Output is correct |
41 |
Correct |
21 ms |
37844 KB |
Output is correct |
42 |
Correct |
33 ms |
45064 KB |
Output is correct |
43 |
Correct |
21 ms |
38484 KB |
Output is correct |
44 |
Correct |
23 ms |
38748 KB |
Output is correct |
45 |
Correct |
543 ms |
101172 KB |
Output is correct |
46 |
Correct |
795 ms |
128748 KB |
Output is correct |
47 |
Correct |
795 ms |
128844 KB |
Output is correct |
48 |
Correct |
34 ms |
45060 KB |
Output is correct |
49 |
Correct |
26 ms |
45068 KB |
Output is correct |
50 |
Correct |
27 ms |
45092 KB |
Output is correct |
51 |
Correct |
28 ms |
45004 KB |
Output is correct |
52 |
Correct |
29 ms |
45004 KB |
Output is correct |
53 |
Correct |
28 ms |
45044 KB |
Output is correct |
54 |
Correct |
29 ms |
45012 KB |
Output is correct |
55 |
Correct |
1181 ms |
155128 KB |
Output is correct |
56 |
Correct |
28 ms |
45012 KB |
Output is correct |
57 |
Correct |
38 ms |
45928 KB |
Output is correct |
58 |
Correct |
42 ms |
48060 KB |
Output is correct |
59 |
Correct |
33 ms |
40480 KB |
Output is correct |
60 |
Correct |
452 ms |
98800 KB |
Output is correct |
61 |
Correct |
697 ms |
119844 KB |
Output is correct |
62 |
Correct |
902 ms |
137164 KB |
Output is correct |
63 |
Correct |
1166 ms |
156740 KB |
Output is correct |
64 |
Correct |
17 ms |
37892 KB |
Output is correct |
65 |
Correct |
27 ms |
45024 KB |
Output is correct |
66 |
Correct |
18 ms |
37844 KB |
Output is correct |
67 |
Correct |
968 ms |
161636 KB |
Output is correct |
68 |
Correct |
947 ms |
161608 KB |
Output is correct |
69 |
Correct |
996 ms |
161080 KB |
Output is correct |
70 |
Correct |
24 ms |
38996 KB |
Output is correct |
71 |
Correct |
29 ms |
40204 KB |
Output is correct |
72 |
Correct |
493 ms |
101568 KB |
Output is correct |
73 |
Correct |
876 ms |
132532 KB |
Output is correct |
74 |
Correct |
1317 ms |
162380 KB |
Output is correct |
75 |
Correct |
1146 ms |
158692 KB |
Output is correct |
76 |
Correct |
946 ms |
161684 KB |
Output is correct |
77 |
Correct |
27 ms |
39380 KB |
Output is correct |
78 |
Correct |
31 ms |
40572 KB |
Output is correct |
79 |
Correct |
470 ms |
100852 KB |
Output is correct |
80 |
Correct |
850 ms |
131360 KB |
Output is correct |
81 |
Correct |
1228 ms |
160652 KB |
Output is correct |
82 |
Correct |
27 ms |
45000 KB |
Output is correct |
83 |
Correct |
27 ms |
45012 KB |
Output is correct |
84 |
Correct |
18 ms |
37860 KB |
Output is correct |
85 |
Correct |
1259 ms |
178148 KB |
Output is correct |
86 |
Correct |
1411 ms |
173932 KB |
Output is correct |
87 |
Correct |
1276 ms |
166288 KB |
Output is correct |
88 |
Correct |
830 ms |
142720 KB |
Output is correct |
89 |
Correct |
323 ms |
79320 KB |
Output is correct |
90 |
Correct |
664 ms |
112156 KB |
Output is correct |
91 |
Correct |
659 ms |
112180 KB |
Output is correct |
92 |
Correct |
967 ms |
160160 KB |
Output is correct |
93 |
Correct |
1008 ms |
160248 KB |
Output is correct |
94 |
Correct |
1018 ms |
160416 KB |
Output is correct |
95 |
Correct |
997 ms |
160108 KB |
Output is correct |
96 |
Correct |
28 ms |
45012 KB |
Output is correct |
97 |
Correct |
72 ms |
52492 KB |
Output is correct |
98 |
Correct |
132 ms |
58528 KB |
Output is correct |
99 |
Correct |
1379 ms |
181392 KB |
Output is correct |
100 |
Correct |
36 ms |
40640 KB |
Output is correct |
101 |
Correct |
122 ms |
51212 KB |
Output is correct |
102 |
Correct |
285 ms |
64660 KB |
Output is correct |
103 |
Correct |
393 ms |
89664 KB |
Output is correct |
104 |
Correct |
589 ms |
106784 KB |
Output is correct |
105 |
Correct |
839 ms |
125396 KB |
Output is correct |
106 |
Correct |
1073 ms |
142792 KB |
Output is correct |
107 |
Correct |
1346 ms |
160620 KB |
Output is correct |
108 |
Correct |
29 ms |
45088 KB |
Output is correct |
109 |
Correct |
30 ms |
45044 KB |
Output is correct |
110 |
Correct |
29 ms |
45028 KB |
Output is correct |
111 |
Correct |
19 ms |
37792 KB |
Output is correct |
112 |
Correct |
19 ms |
37828 KB |
Output is correct |
113 |
Correct |
29 ms |
45012 KB |
Output is correct |
114 |
Correct |
28 ms |
45004 KB |
Output is correct |
115 |
Correct |
29 ms |
45044 KB |
Output is correct |
116 |
Correct |
29 ms |
45036 KB |
Output is correct |
117 |
Correct |
19 ms |
37784 KB |
Output is correct |
118 |
Correct |
32 ms |
44996 KB |
Output is correct |
119 |
Correct |
21 ms |
38484 KB |
Output is correct |
120 |
Correct |
26 ms |
38672 KB |
Output is correct |
121 |
Correct |
483 ms |
101284 KB |
Output is correct |
122 |
Correct |
805 ms |
128968 KB |
Output is correct |
123 |
Correct |
832 ms |
128768 KB |
Output is correct |
124 |
Correct |
18 ms |
37776 KB |
Output is correct |
125 |
Correct |
28 ms |
45036 KB |
Output is correct |
126 |
Correct |
18 ms |
37792 KB |
Output is correct |
127 |
Correct |
996 ms |
160200 KB |
Output is correct |
128 |
Correct |
963 ms |
160312 KB |
Output is correct |
129 |
Correct |
943 ms |
159596 KB |
Output is correct |
130 |
Correct |
26 ms |
38940 KB |
Output is correct |
131 |
Correct |
29 ms |
40148 KB |
Output is correct |
132 |
Correct |
495 ms |
100828 KB |
Output is correct |
133 |
Correct |
932 ms |
131252 KB |
Output is correct |
134 |
Correct |
1261 ms |
160916 KB |
Output is correct |
135 |
Correct |
1020 ms |
160688 KB |
Output is correct |
136 |
Correct |
1049 ms |
160956 KB |
Output is correct |
137 |
Correct |
1369 ms |
179232 KB |
Output is correct |
138 |
Correct |
1168 ms |
153028 KB |
Output is correct |
139 |
Correct |
1006 ms |
144360 KB |
Output is correct |
140 |
Correct |
32 ms |
44984 KB |
Output is correct |
141 |
Correct |
127 ms |
61248 KB |
Output is correct |
142 |
Correct |
52 ms |
43324 KB |
Output is correct |
143 |
Correct |
186 ms |
56456 KB |
Output is correct |
144 |
Correct |
348 ms |
69724 KB |
Output is correct |
145 |
Correct |
525 ms |
99508 KB |
Output is correct |
146 |
Correct |
728 ms |
113796 KB |
Output is correct |
147 |
Correct |
890 ms |
129376 KB |
Output is correct |
148 |
Correct |
1081 ms |
143316 KB |
Output is correct |
149 |
Correct |
1353 ms |
158124 KB |
Output is correct |
150 |
Correct |
1151 ms |
157260 KB |
Output is correct |
151 |
Correct |
980 ms |
160220 KB |
Output is correct |
152 |
Correct |
25 ms |
39360 KB |
Output is correct |
153 |
Correct |
30 ms |
40524 KB |
Output is correct |
154 |
Correct |
472 ms |
100048 KB |
Output is correct |
155 |
Correct |
850 ms |
130076 KB |
Output is correct |
156 |
Correct |
1262 ms |
159252 KB |
Output is correct |
157 |
Correct |
31 ms |
45004 KB |
Output is correct |
158 |
Correct |
17 ms |
37828 KB |
Output is correct |
159 |
Correct |
26 ms |
45032 KB |
Output is correct |
160 |
Correct |
28 ms |
45076 KB |
Output is correct |
161 |
Incorrect |
1061 ms |
138812 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |