#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]*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;
}
}
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;
}
}
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]*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<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<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++){
| ~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
45052 KB |
Output is correct |
2 |
Correct |
29 ms |
45004 KB |
Output is correct |
3 |
Correct |
19 ms |
37844 KB |
Output is correct |
4 |
Correct |
30 ms |
45060 KB |
Output is correct |
5 |
Correct |
36 ms |
45048 KB |
Output is correct |
6 |
Correct |
20 ms |
37880 KB |
Output is correct |
7 |
Correct |
20 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37884 KB |
Output is correct |
9 |
Correct |
204 ms |
95924 KB |
Output is correct |
10 |
Correct |
41 ms |
49584 KB |
Output is correct |
11 |
Correct |
87 ms |
70964 KB |
Output is correct |
12 |
Correct |
45 ms |
52120 KB |
Output is correct |
13 |
Correct |
43 ms |
53060 KB |
Output is correct |
14 |
Correct |
21 ms |
38132 KB |
Output is correct |
15 |
Correct |
21 ms |
38500 KB |
Output is correct |
16 |
Correct |
215 ms |
95972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
45052 KB |
Output is correct |
2 |
Correct |
29 ms |
45004 KB |
Output is correct |
3 |
Correct |
19 ms |
37844 KB |
Output is correct |
4 |
Correct |
30 ms |
45060 KB |
Output is correct |
5 |
Correct |
36 ms |
45048 KB |
Output is correct |
6 |
Correct |
20 ms |
37880 KB |
Output is correct |
7 |
Correct |
20 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37884 KB |
Output is correct |
9 |
Correct |
204 ms |
95924 KB |
Output is correct |
10 |
Correct |
41 ms |
49584 KB |
Output is correct |
11 |
Correct |
87 ms |
70964 KB |
Output is correct |
12 |
Correct |
45 ms |
52120 KB |
Output is correct |
13 |
Correct |
43 ms |
53060 KB |
Output is correct |
14 |
Correct |
21 ms |
38132 KB |
Output is correct |
15 |
Correct |
21 ms |
38500 KB |
Output is correct |
16 |
Correct |
215 ms |
95972 KB |
Output is correct |
17 |
Correct |
30 ms |
45044 KB |
Output is correct |
18 |
Correct |
30 ms |
45040 KB |
Output is correct |
19 |
Correct |
32 ms |
45076 KB |
Output is correct |
20 |
Correct |
29 ms |
45080 KB |
Output is correct |
21 |
Correct |
19 ms |
37824 KB |
Output is correct |
22 |
Correct |
29 ms |
45008 KB |
Output is correct |
23 |
Correct |
600 ms |
147656 KB |
Output is correct |
24 |
Correct |
30 ms |
45048 KB |
Output is correct |
25 |
Correct |
32 ms |
45568 KB |
Output is correct |
26 |
Correct |
22 ms |
38608 KB |
Output is correct |
27 |
Correct |
23 ms |
38900 KB |
Output is correct |
28 |
Correct |
184 ms |
84912 KB |
Output is correct |
29 |
Correct |
304 ms |
107020 KB |
Output is correct |
30 |
Correct |
436 ms |
127560 KB |
Output is correct |
31 |
Correct |
574 ms |
147560 KB |
Output is correct |
32 |
Correct |
29 ms |
45012 KB |
Output is correct |
33 |
Correct |
29 ms |
44996 KB |
Output is correct |
34 |
Correct |
30 ms |
44996 KB |
Output is correct |
35 |
Correct |
20 ms |
37864 KB |
Output is correct |
36 |
Correct |
20 ms |
37844 KB |
Output is correct |
37 |
Correct |
30 ms |
45008 KB |
Output is correct |
38 |
Correct |
30 ms |
45012 KB |
Output is correct |
39 |
Correct |
30 ms |
45068 KB |
Output is correct |
40 |
Correct |
31 ms |
45048 KB |
Output is correct |
41 |
Correct |
20 ms |
37884 KB |
Output is correct |
42 |
Correct |
31 ms |
45060 KB |
Output is correct |
43 |
Correct |
20 ms |
38356 KB |
Output is correct |
44 |
Correct |
22 ms |
38660 KB |
Output is correct |
45 |
Correct |
271 ms |
97412 KB |
Output is correct |
46 |
Correct |
472 ms |
122912 KB |
Output is correct |
47 |
Correct |
486 ms |
122820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
45052 KB |
Output is correct |
2 |
Correct |
29 ms |
45004 KB |
Output is correct |
3 |
Correct |
19 ms |
37844 KB |
Output is correct |
4 |
Correct |
30 ms |
45060 KB |
Output is correct |
5 |
Correct |
36 ms |
45048 KB |
Output is correct |
6 |
Correct |
20 ms |
37880 KB |
Output is correct |
7 |
Correct |
20 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37884 KB |
Output is correct |
9 |
Correct |
204 ms |
95924 KB |
Output is correct |
10 |
Correct |
41 ms |
49584 KB |
Output is correct |
11 |
Correct |
87 ms |
70964 KB |
Output is correct |
12 |
Correct |
45 ms |
52120 KB |
Output is correct |
13 |
Correct |
43 ms |
53060 KB |
Output is correct |
14 |
Correct |
21 ms |
38132 KB |
Output is correct |
15 |
Correct |
21 ms |
38500 KB |
Output is correct |
16 |
Correct |
215 ms |
95972 KB |
Output is correct |
17 |
Correct |
30 ms |
45044 KB |
Output is correct |
18 |
Correct |
30 ms |
45040 KB |
Output is correct |
19 |
Correct |
32 ms |
45076 KB |
Output is correct |
20 |
Correct |
29 ms |
45080 KB |
Output is correct |
21 |
Correct |
19 ms |
37824 KB |
Output is correct |
22 |
Correct |
29 ms |
45008 KB |
Output is correct |
23 |
Correct |
600 ms |
147656 KB |
Output is correct |
24 |
Correct |
30 ms |
45048 KB |
Output is correct |
25 |
Correct |
32 ms |
45568 KB |
Output is correct |
26 |
Correct |
22 ms |
38608 KB |
Output is correct |
27 |
Correct |
23 ms |
38900 KB |
Output is correct |
28 |
Correct |
184 ms |
84912 KB |
Output is correct |
29 |
Correct |
304 ms |
107020 KB |
Output is correct |
30 |
Correct |
436 ms |
127560 KB |
Output is correct |
31 |
Correct |
574 ms |
147560 KB |
Output is correct |
32 |
Correct |
29 ms |
45012 KB |
Output is correct |
33 |
Correct |
29 ms |
44996 KB |
Output is correct |
34 |
Correct |
30 ms |
44996 KB |
Output is correct |
35 |
Correct |
20 ms |
37864 KB |
Output is correct |
36 |
Correct |
20 ms |
37844 KB |
Output is correct |
37 |
Correct |
30 ms |
45008 KB |
Output is correct |
38 |
Correct |
30 ms |
45012 KB |
Output is correct |
39 |
Correct |
30 ms |
45068 KB |
Output is correct |
40 |
Correct |
31 ms |
45048 KB |
Output is correct |
41 |
Correct |
20 ms |
37884 KB |
Output is correct |
42 |
Correct |
31 ms |
45060 KB |
Output is correct |
43 |
Correct |
20 ms |
38356 KB |
Output is correct |
44 |
Correct |
22 ms |
38660 KB |
Output is correct |
45 |
Correct |
271 ms |
97412 KB |
Output is correct |
46 |
Correct |
472 ms |
122912 KB |
Output is correct |
47 |
Correct |
486 ms |
122820 KB |
Output is correct |
48 |
Correct |
30 ms |
45040 KB |
Output is correct |
49 |
Correct |
30 ms |
45040 KB |
Output is correct |
50 |
Correct |
31 ms |
45044 KB |
Output is correct |
51 |
Correct |
31 ms |
45008 KB |
Output is correct |
52 |
Correct |
35 ms |
45208 KB |
Output is correct |
53 |
Correct |
30 ms |
45012 KB |
Output is correct |
54 |
Correct |
30 ms |
45012 KB |
Output is correct |
55 |
Correct |
653 ms |
148340 KB |
Output is correct |
56 |
Correct |
30 ms |
45012 KB |
Output is correct |
57 |
Correct |
32 ms |
45876 KB |
Output is correct |
58 |
Correct |
39 ms |
47844 KB |
Output is correct |
59 |
Correct |
26 ms |
40272 KB |
Output is correct |
60 |
Correct |
261 ms |
94544 KB |
Output is correct |
61 |
Correct |
376 ms |
115856 KB |
Output is correct |
62 |
Correct |
474 ms |
130872 KB |
Output is correct |
63 |
Correct |
655 ms |
148512 KB |
Output is correct |
64 |
Correct |
20 ms |
37844 KB |
Output is correct |
65 |
Correct |
30 ms |
45004 KB |
Output is correct |
66 |
Correct |
19 ms |
37844 KB |
Output is correct |
67 |
Correct |
467 ms |
150800 KB |
Output is correct |
68 |
Correct |
467 ms |
150768 KB |
Output is correct |
69 |
Correct |
472 ms |
150328 KB |
Output is correct |
70 |
Correct |
22 ms |
38868 KB |
Output is correct |
71 |
Correct |
25 ms |
40020 KB |
Output is correct |
72 |
Correct |
277 ms |
97488 KB |
Output is correct |
73 |
Correct |
483 ms |
125404 KB |
Output is correct |
74 |
Correct |
717 ms |
154000 KB |
Output is correct |
75 |
Correct |
631 ms |
147008 KB |
Output is correct |
76 |
Correct |
464 ms |
150708 KB |
Output is correct |
77 |
Correct |
22 ms |
39072 KB |
Output is correct |
78 |
Correct |
26 ms |
40200 KB |
Output is correct |
79 |
Correct |
247 ms |
95252 KB |
Output is correct |
80 |
Correct |
447 ms |
124056 KB |
Output is correct |
81 |
Correct |
638 ms |
149404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
45052 KB |
Output is correct |
2 |
Correct |
29 ms |
45004 KB |
Output is correct |
3 |
Correct |
19 ms |
37844 KB |
Output is correct |
4 |
Correct |
30 ms |
45060 KB |
Output is correct |
5 |
Correct |
36 ms |
45048 KB |
Output is correct |
6 |
Correct |
20 ms |
37880 KB |
Output is correct |
7 |
Correct |
20 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37884 KB |
Output is correct |
9 |
Correct |
204 ms |
95924 KB |
Output is correct |
10 |
Correct |
41 ms |
49584 KB |
Output is correct |
11 |
Correct |
87 ms |
70964 KB |
Output is correct |
12 |
Correct |
45 ms |
52120 KB |
Output is correct |
13 |
Correct |
43 ms |
53060 KB |
Output is correct |
14 |
Correct |
21 ms |
38132 KB |
Output is correct |
15 |
Correct |
21 ms |
38500 KB |
Output is correct |
16 |
Correct |
215 ms |
95972 KB |
Output is correct |
17 |
Correct |
27 ms |
45004 KB |
Output is correct |
18 |
Correct |
29 ms |
45012 KB |
Output is correct |
19 |
Correct |
19 ms |
37896 KB |
Output is correct |
20 |
Correct |
807 ms |
172340 KB |
Output is correct |
21 |
Correct |
859 ms |
167732 KB |
Output is correct |
22 |
Correct |
822 ms |
160260 KB |
Output is correct |
23 |
Correct |
472 ms |
130552 KB |
Output is correct |
24 |
Correct |
152 ms |
70524 KB |
Output is correct |
25 |
Correct |
441 ms |
102568 KB |
Output is correct |
26 |
Correct |
409 ms |
103612 KB |
Output is correct |
27 |
Correct |
587 ms |
150432 KB |
Output is correct |
28 |
Correct |
585 ms |
150492 KB |
Output is correct |
29 |
Correct |
584 ms |
150592 KB |
Output is correct |
30 |
Correct |
602 ms |
150424 KB |
Output is correct |
31 |
Correct |
32 ms |
45004 KB |
Output is correct |
32 |
Correct |
54 ms |
51992 KB |
Output is correct |
33 |
Correct |
60 ms |
53948 KB |
Output is correct |
34 |
Correct |
854 ms |
174848 KB |
Output is correct |
35 |
Correct |
26 ms |
40276 KB |
Output is correct |
36 |
Correct |
59 ms |
49032 KB |
Output is correct |
37 |
Correct |
134 ms |
60344 KB |
Output is correct |
38 |
Correct |
217 ms |
86976 KB |
Output is correct |
39 |
Correct |
342 ms |
103340 KB |
Output is correct |
40 |
Correct |
493 ms |
119984 KB |
Output is correct |
41 |
Correct |
662 ms |
136648 KB |
Output is correct |
42 |
Correct |
879 ms |
152436 KB |
Output is correct |
43 |
Correct |
28 ms |
45004 KB |
Output is correct |
44 |
Correct |
33 ms |
44980 KB |
Output is correct |
45 |
Correct |
30 ms |
45008 KB |
Output is correct |
46 |
Correct |
19 ms |
37888 KB |
Output is correct |
47 |
Correct |
20 ms |
37844 KB |
Output is correct |
48 |
Correct |
30 ms |
45060 KB |
Output is correct |
49 |
Correct |
29 ms |
45012 KB |
Output is correct |
50 |
Correct |
29 ms |
45064 KB |
Output is correct |
51 |
Correct |
28 ms |
45000 KB |
Output is correct |
52 |
Correct |
19 ms |
37844 KB |
Output is correct |
53 |
Correct |
28 ms |
45084 KB |
Output is correct |
54 |
Correct |
20 ms |
38380 KB |
Output is correct |
55 |
Correct |
20 ms |
38612 KB |
Output is correct |
56 |
Correct |
288 ms |
97172 KB |
Output is correct |
57 |
Correct |
448 ms |
122544 KB |
Output is correct |
58 |
Correct |
452 ms |
122588 KB |
Output is correct |
59 |
Correct |
19 ms |
37800 KB |
Output is correct |
60 |
Correct |
27 ms |
45032 KB |
Output is correct |
61 |
Correct |
17 ms |
37808 KB |
Output is correct |
62 |
Correct |
473 ms |
150532 KB |
Output is correct |
63 |
Correct |
468 ms |
150488 KB |
Output is correct |
64 |
Correct |
499 ms |
149988 KB |
Output is correct |
65 |
Correct |
22 ms |
38852 KB |
Output is correct |
66 |
Correct |
24 ms |
39892 KB |
Output is correct |
67 |
Correct |
276 ms |
97188 KB |
Output is correct |
68 |
Correct |
491 ms |
125192 KB |
Output is correct |
69 |
Correct |
733 ms |
153704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
45052 KB |
Output is correct |
2 |
Correct |
29 ms |
45004 KB |
Output is correct |
3 |
Correct |
19 ms |
37844 KB |
Output is correct |
4 |
Correct |
30 ms |
45060 KB |
Output is correct |
5 |
Correct |
36 ms |
45048 KB |
Output is correct |
6 |
Correct |
20 ms |
37880 KB |
Output is correct |
7 |
Correct |
20 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37884 KB |
Output is correct |
9 |
Correct |
204 ms |
95924 KB |
Output is correct |
10 |
Correct |
41 ms |
49584 KB |
Output is correct |
11 |
Correct |
87 ms |
70964 KB |
Output is correct |
12 |
Correct |
45 ms |
52120 KB |
Output is correct |
13 |
Correct |
43 ms |
53060 KB |
Output is correct |
14 |
Correct |
21 ms |
38132 KB |
Output is correct |
15 |
Correct |
21 ms |
38500 KB |
Output is correct |
16 |
Correct |
215 ms |
95972 KB |
Output is correct |
17 |
Correct |
625 ms |
150856 KB |
Output is correct |
18 |
Correct |
653 ms |
151056 KB |
Output is correct |
19 |
Correct |
861 ms |
171544 KB |
Output is correct |
20 |
Correct |
746 ms |
145964 KB |
Output is correct |
21 |
Correct |
590 ms |
134664 KB |
Output is correct |
22 |
Correct |
31 ms |
45012 KB |
Output is correct |
23 |
Correct |
91 ms |
60032 KB |
Output is correct |
24 |
Correct |
34 ms |
42700 KB |
Output is correct |
25 |
Correct |
78 ms |
54800 KB |
Output is correct |
26 |
Correct |
173 ms |
66244 KB |
Output is correct |
27 |
Correct |
277 ms |
95688 KB |
Output is correct |
28 |
Correct |
405 ms |
109736 KB |
Output is correct |
29 |
Correct |
553 ms |
125132 KB |
Output is correct |
30 |
Correct |
670 ms |
137476 KB |
Output is correct |
31 |
Correct |
847 ms |
150740 KB |
Output is correct |
32 |
Correct |
613 ms |
146776 KB |
Output is correct |
33 |
Correct |
477 ms |
150452 KB |
Output is correct |
34 |
Correct |
23 ms |
39124 KB |
Output is correct |
35 |
Correct |
24 ms |
40116 KB |
Output is correct |
36 |
Correct |
259 ms |
95088 KB |
Output is correct |
37 |
Correct |
453 ms |
123816 KB |
Output is correct |
38 |
Correct |
657 ms |
149196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
45052 KB |
Output is correct |
2 |
Correct |
29 ms |
45004 KB |
Output is correct |
3 |
Correct |
19 ms |
37844 KB |
Output is correct |
4 |
Correct |
30 ms |
45060 KB |
Output is correct |
5 |
Correct |
36 ms |
45048 KB |
Output is correct |
6 |
Correct |
20 ms |
37880 KB |
Output is correct |
7 |
Correct |
20 ms |
37844 KB |
Output is correct |
8 |
Correct |
20 ms |
37884 KB |
Output is correct |
9 |
Correct |
204 ms |
95924 KB |
Output is correct |
10 |
Correct |
41 ms |
49584 KB |
Output is correct |
11 |
Correct |
87 ms |
70964 KB |
Output is correct |
12 |
Correct |
45 ms |
52120 KB |
Output is correct |
13 |
Correct |
43 ms |
53060 KB |
Output is correct |
14 |
Correct |
21 ms |
38132 KB |
Output is correct |
15 |
Correct |
21 ms |
38500 KB |
Output is correct |
16 |
Correct |
215 ms |
95972 KB |
Output is correct |
17 |
Correct |
30 ms |
45044 KB |
Output is correct |
18 |
Correct |
30 ms |
45040 KB |
Output is correct |
19 |
Correct |
32 ms |
45076 KB |
Output is correct |
20 |
Correct |
29 ms |
45080 KB |
Output is correct |
21 |
Correct |
19 ms |
37824 KB |
Output is correct |
22 |
Correct |
29 ms |
45008 KB |
Output is correct |
23 |
Correct |
600 ms |
147656 KB |
Output is correct |
24 |
Correct |
30 ms |
45048 KB |
Output is correct |
25 |
Correct |
32 ms |
45568 KB |
Output is correct |
26 |
Correct |
22 ms |
38608 KB |
Output is correct |
27 |
Correct |
23 ms |
38900 KB |
Output is correct |
28 |
Correct |
184 ms |
84912 KB |
Output is correct |
29 |
Correct |
304 ms |
107020 KB |
Output is correct |
30 |
Correct |
436 ms |
127560 KB |
Output is correct |
31 |
Correct |
574 ms |
147560 KB |
Output is correct |
32 |
Correct |
29 ms |
45012 KB |
Output is correct |
33 |
Correct |
29 ms |
44996 KB |
Output is correct |
34 |
Correct |
30 ms |
44996 KB |
Output is correct |
35 |
Correct |
20 ms |
37864 KB |
Output is correct |
36 |
Correct |
20 ms |
37844 KB |
Output is correct |
37 |
Correct |
30 ms |
45008 KB |
Output is correct |
38 |
Correct |
30 ms |
45012 KB |
Output is correct |
39 |
Correct |
30 ms |
45068 KB |
Output is correct |
40 |
Correct |
31 ms |
45048 KB |
Output is correct |
41 |
Correct |
20 ms |
37884 KB |
Output is correct |
42 |
Correct |
31 ms |
45060 KB |
Output is correct |
43 |
Correct |
20 ms |
38356 KB |
Output is correct |
44 |
Correct |
22 ms |
38660 KB |
Output is correct |
45 |
Correct |
271 ms |
97412 KB |
Output is correct |
46 |
Correct |
472 ms |
122912 KB |
Output is correct |
47 |
Correct |
486 ms |
122820 KB |
Output is correct |
48 |
Correct |
30 ms |
45040 KB |
Output is correct |
49 |
Correct |
30 ms |
45040 KB |
Output is correct |
50 |
Correct |
31 ms |
45044 KB |
Output is correct |
51 |
Correct |
31 ms |
45008 KB |
Output is correct |
52 |
Correct |
35 ms |
45208 KB |
Output is correct |
53 |
Correct |
30 ms |
45012 KB |
Output is correct |
54 |
Correct |
30 ms |
45012 KB |
Output is correct |
55 |
Correct |
653 ms |
148340 KB |
Output is correct |
56 |
Correct |
30 ms |
45012 KB |
Output is correct |
57 |
Correct |
32 ms |
45876 KB |
Output is correct |
58 |
Correct |
39 ms |
47844 KB |
Output is correct |
59 |
Correct |
26 ms |
40272 KB |
Output is correct |
60 |
Correct |
261 ms |
94544 KB |
Output is correct |
61 |
Correct |
376 ms |
115856 KB |
Output is correct |
62 |
Correct |
474 ms |
130872 KB |
Output is correct |
63 |
Correct |
655 ms |
148512 KB |
Output is correct |
64 |
Correct |
20 ms |
37844 KB |
Output is correct |
65 |
Correct |
30 ms |
45004 KB |
Output is correct |
66 |
Correct |
19 ms |
37844 KB |
Output is correct |
67 |
Correct |
467 ms |
150800 KB |
Output is correct |
68 |
Correct |
467 ms |
150768 KB |
Output is correct |
69 |
Correct |
472 ms |
150328 KB |
Output is correct |
70 |
Correct |
22 ms |
38868 KB |
Output is correct |
71 |
Correct |
25 ms |
40020 KB |
Output is correct |
72 |
Correct |
277 ms |
97488 KB |
Output is correct |
73 |
Correct |
483 ms |
125404 KB |
Output is correct |
74 |
Correct |
717 ms |
154000 KB |
Output is correct |
75 |
Correct |
631 ms |
147008 KB |
Output is correct |
76 |
Correct |
464 ms |
150708 KB |
Output is correct |
77 |
Correct |
22 ms |
39072 KB |
Output is correct |
78 |
Correct |
26 ms |
40200 KB |
Output is correct |
79 |
Correct |
247 ms |
95252 KB |
Output is correct |
80 |
Correct |
447 ms |
124056 KB |
Output is correct |
81 |
Correct |
638 ms |
149404 KB |
Output is correct |
82 |
Correct |
27 ms |
45004 KB |
Output is correct |
83 |
Correct |
29 ms |
45012 KB |
Output is correct |
84 |
Correct |
19 ms |
37896 KB |
Output is correct |
85 |
Correct |
807 ms |
172340 KB |
Output is correct |
86 |
Correct |
859 ms |
167732 KB |
Output is correct |
87 |
Correct |
822 ms |
160260 KB |
Output is correct |
88 |
Correct |
472 ms |
130552 KB |
Output is correct |
89 |
Correct |
152 ms |
70524 KB |
Output is correct |
90 |
Correct |
441 ms |
102568 KB |
Output is correct |
91 |
Correct |
409 ms |
103612 KB |
Output is correct |
92 |
Correct |
587 ms |
150432 KB |
Output is correct |
93 |
Correct |
585 ms |
150492 KB |
Output is correct |
94 |
Correct |
584 ms |
150592 KB |
Output is correct |
95 |
Correct |
602 ms |
150424 KB |
Output is correct |
96 |
Correct |
32 ms |
45004 KB |
Output is correct |
97 |
Correct |
54 ms |
51992 KB |
Output is correct |
98 |
Correct |
60 ms |
53948 KB |
Output is correct |
99 |
Correct |
854 ms |
174848 KB |
Output is correct |
100 |
Correct |
26 ms |
40276 KB |
Output is correct |
101 |
Correct |
59 ms |
49032 KB |
Output is correct |
102 |
Correct |
134 ms |
60344 KB |
Output is correct |
103 |
Correct |
217 ms |
86976 KB |
Output is correct |
104 |
Correct |
342 ms |
103340 KB |
Output is correct |
105 |
Correct |
493 ms |
119984 KB |
Output is correct |
106 |
Correct |
662 ms |
136648 KB |
Output is correct |
107 |
Correct |
879 ms |
152436 KB |
Output is correct |
108 |
Correct |
28 ms |
45004 KB |
Output is correct |
109 |
Correct |
33 ms |
44980 KB |
Output is correct |
110 |
Correct |
30 ms |
45008 KB |
Output is correct |
111 |
Correct |
19 ms |
37888 KB |
Output is correct |
112 |
Correct |
20 ms |
37844 KB |
Output is correct |
113 |
Correct |
30 ms |
45060 KB |
Output is correct |
114 |
Correct |
29 ms |
45012 KB |
Output is correct |
115 |
Correct |
29 ms |
45064 KB |
Output is correct |
116 |
Correct |
28 ms |
45000 KB |
Output is correct |
117 |
Correct |
19 ms |
37844 KB |
Output is correct |
118 |
Correct |
28 ms |
45084 KB |
Output is correct |
119 |
Correct |
20 ms |
38380 KB |
Output is correct |
120 |
Correct |
20 ms |
38612 KB |
Output is correct |
121 |
Correct |
288 ms |
97172 KB |
Output is correct |
122 |
Correct |
448 ms |
122544 KB |
Output is correct |
123 |
Correct |
452 ms |
122588 KB |
Output is correct |
124 |
Correct |
19 ms |
37800 KB |
Output is correct |
125 |
Correct |
27 ms |
45032 KB |
Output is correct |
126 |
Correct |
17 ms |
37808 KB |
Output is correct |
127 |
Correct |
473 ms |
150532 KB |
Output is correct |
128 |
Correct |
468 ms |
150488 KB |
Output is correct |
129 |
Correct |
499 ms |
149988 KB |
Output is correct |
130 |
Correct |
22 ms |
38852 KB |
Output is correct |
131 |
Correct |
24 ms |
39892 KB |
Output is correct |
132 |
Correct |
276 ms |
97188 KB |
Output is correct |
133 |
Correct |
491 ms |
125192 KB |
Output is correct |
134 |
Correct |
733 ms |
153704 KB |
Output is correct |
135 |
Correct |
625 ms |
150856 KB |
Output is correct |
136 |
Correct |
653 ms |
151056 KB |
Output is correct |
137 |
Correct |
861 ms |
171544 KB |
Output is correct |
138 |
Correct |
746 ms |
145964 KB |
Output is correct |
139 |
Correct |
590 ms |
134664 KB |
Output is correct |
140 |
Correct |
31 ms |
45012 KB |
Output is correct |
141 |
Correct |
91 ms |
60032 KB |
Output is correct |
142 |
Correct |
34 ms |
42700 KB |
Output is correct |
143 |
Correct |
78 ms |
54800 KB |
Output is correct |
144 |
Correct |
173 ms |
66244 KB |
Output is correct |
145 |
Correct |
277 ms |
95688 KB |
Output is correct |
146 |
Correct |
405 ms |
109736 KB |
Output is correct |
147 |
Correct |
553 ms |
125132 KB |
Output is correct |
148 |
Correct |
670 ms |
137476 KB |
Output is correct |
149 |
Correct |
847 ms |
150740 KB |
Output is correct |
150 |
Correct |
613 ms |
146776 KB |
Output is correct |
151 |
Correct |
477 ms |
150452 KB |
Output is correct |
152 |
Correct |
23 ms |
39124 KB |
Output is correct |
153 |
Correct |
24 ms |
40116 KB |
Output is correct |
154 |
Correct |
259 ms |
95088 KB |
Output is correct |
155 |
Correct |
453 ms |
123816 KB |
Output is correct |
156 |
Correct |
657 ms |
149196 KB |
Output is correct |
157 |
Correct |
29 ms |
44988 KB |
Output is correct |
158 |
Correct |
18 ms |
37856 KB |
Output is correct |
159 |
Correct |
28 ms |
45060 KB |
Output is correct |
160 |
Correct |
28 ms |
45068 KB |
Output is correct |
161 |
Incorrect |
681 ms |
133780 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |