#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
int dsu[200010],L,R;
vector <int> g[200010],match1,match2,dist;
int prt(int n){
if (dsu[n]==n) return n;
return dsu[n]=prt(dsu[n]);
}
void unn(int u,int v){
dsu[prt(u)]=dsu[prt(v)];
}
map <pair <int,int>,int> mp;
vector <pair <int,int> > vmp;
int gt(int u,int v){
if (mp.find({u,v})==mp.end()){
mp[{u,v}]=mp.size()+1;
vmp.push_back({u,v});
}
return mp[{u,v}];
}
void bfs(){
dist.clear();
for (int i=0; i<L; i++) dist.push_back(-1);
queue <int> q;
for (int i=0; i<L; i++){
if (match1[i]==-1){
dist[i]=0;
q.push(i);
}
}
while (!q.empty()){
int tp=q.front(); q.pop();
for (int i:g[tp]){
if (match2[i]!=-1&&dist[match2[i]]==-1){
dist[match2[i]]=dist[tp]+1;
q.push(match2[i]);
}
}
}
}
int dfs(int cur){
for (int i:g[cur]){
if (match2[i]==-1){
match1[cur]=i;
match2[i]=cur;
return 1;
}
}
for (int i:g[cur]){
if (dist[match2[i]]==dist[cur]+1&&dfs(match2[i])){
match1[cur]=i;
match2[i]=cur;
return 1;
}
}
return 0;
}
bool cmp(pair <pair <int,int>,int> u,pair <pair <int,int>,int> v){
if (u.first.second!=v.first.second) return u.first.second<v.first.second;
return u.first.first<v.first.first;
}
int construct_roads(vector <int> x,vector <int> y){
int n=x.size();
pair <pair <int,int>,int> a[n];
for (int i=0; i<n; i++) a[i]={{x[i],y[i]},i};
pair <int,int> cpy[n];
for (int i=0; i<n; i++) cpy[i]={x[i],y[i]};
sort(a,a+n);
for (int i=0; i<n; i++) dsu[i]=i;
vector <int> u,v,A,B;
vmp.push_back({-1,-1});
vector <pair <int,int> > hor,ver;
for (int i=1; i<n; i++){
if (a[i-1].first.first==a[i].first.first&&a[i-1].first.second+2==a[i].first.second){
ver.push_back({a[i-1].second,a[i].second});
}
}
sort(a,a+n,cmp);
for (int i=1; i<n; i++){
if (a[i-1].first.first+2==a[i].first.first&&a[i-1].first.second==a[i].first.second){
hor.push_back({a[i-1].second,a[i].second});
}
}
int cnt=0;
for (int iters=0; iters<n; iters++){
if (hor.size()>iters&&prt(hor[iters].first)!=prt(hor[iters].second)){
u.push_back(hor[iters].first);
v.push_back(hor[iters].second);
unn(hor[iters].first,hor[iters].second);
int tp=gt(cpy[hor[iters].first].first+1,cpy[hor[iters].first].second-1);
g[cnt].push_back(tp);
tp=gt(cpy[hor[iters].first].first+1,cpy[hor[iters].first].second+1);
g[cnt].push_back(tp);
cnt++;
}
if (ver.size()>iters&&prt(ver[iters].first)!=prt(ver[iters].second)){
u.push_back(ver[iters].first);
v.push_back(ver[iters].second);
unn(ver[iters].first,ver[iters].second);
int tp=gt(cpy[ver[iters].first].first-1,cpy[ver[iters].first].second+1);
g[cnt].push_back(tp);
tp=gt(cpy[ver[iters].first].first+1,cpy[ver[iters].first].second+1);
g[cnt].push_back(tp);
cnt++;
}
if (hor.size()>iters+1&&prt(hor.back().first)!=prt(hor.back().second)){
u.push_back(hor.back().first);
v.push_back(hor.back().second);
unn(hor.back().first,hor.back().second);
int tp=gt(cpy[hor.back().first].first+1,cpy[hor.back().first].second-1);
g[cnt].push_back(tp);
tp=gt(cpy[hor.back().first].first+1,cpy[hor.back().first].second+1);
g[cnt].push_back(tp);
cnt++;
hor.pop_back();
}
if (ver.size()>iters+1&&prt(ver.back().first)!=prt(ver.back().second)){
u.push_back(ver.back().first);
v.push_back(ver.back().second);
unn(ver.back().first,ver.back().second);
int tp=gt(cpy[ver.back().first].first-1,cpy[ver.back().first].second+1);
g[cnt].push_back(tp);
tp=gt(cpy[ver.back().first].first+1,cpy[ver.back().first].second+1);
g[cnt].push_back(tp);
cnt++;
ver.pop_back();
}
}
for (int i=1; i<n; i++){
if (prt(a[i].second)!=prt(a[0].second)) return 0;
}
for (int i=0; i<n-1; i++) match1.push_back(-1);
for (int i=0; i<=vmp.size(); i++) match2.push_back(-1);
L=match1.size(); R=match2.size();
int flo=0;
while (1){
bfs();
int aug=0;
for (int i=0; i<L; i++){
if (match1[i]==-1) aug+=dfs(i);
}
if (!aug) break;
flo+=aug;
}
if (flo!=L) return 0;
for (int i=0; i<L; i++){
int tp=match1[i];
A.push_back(vmp[tp].first);
B.push_back(vmp[tp].second);
}
build(u,v,A,B);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:87:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
87 | if (hor.size()>iters&&prt(hor[iters].first)!=prt(hor[iters].second)){
| ~~~~~~~~~~^~~~~~
parks.cpp:97:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
97 | if (ver.size()>iters&&prt(ver[iters].first)!=prt(ver[iters].second)){
| ~~~~~~~~~~^~~~~~
parks.cpp:107:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
107 | if (hor.size()>iters+1&&prt(hor.back().first)!=prt(hor.back().second)){
| ~~~~~~~~~~^~~~~~~~
parks.cpp:118:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
118 | if (ver.size()>iters+1&&prt(ver.back().first)!=prt(ver.back().second)){
| ~~~~~~~~~~^~~~~~~~
parks.cpp:134:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
134 | for (int i=0; i<=vmp.size(); i++) match2.push_back(-1);
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4952 KB |
Output is correct |
4 |
Correct |
1 ms |
4956 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Correct |
166 ms |
34764 KB |
Output is correct |
10 |
Correct |
13 ms |
8068 KB |
Output is correct |
11 |
Correct |
75 ms |
21108 KB |
Output is correct |
12 |
Correct |
19 ms |
9564 KB |
Output is correct |
13 |
Correct |
51 ms |
15416 KB |
Output is correct |
14 |
Correct |
2 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5468 KB |
Output is correct |
16 |
Correct |
162 ms |
34800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4952 KB |
Output is correct |
4 |
Correct |
1 ms |
4956 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Correct |
166 ms |
34764 KB |
Output is correct |
10 |
Correct |
13 ms |
8068 KB |
Output is correct |
11 |
Correct |
75 ms |
21108 KB |
Output is correct |
12 |
Correct |
19 ms |
9564 KB |
Output is correct |
13 |
Correct |
51 ms |
15416 KB |
Output is correct |
14 |
Correct |
2 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5468 KB |
Output is correct |
16 |
Correct |
162 ms |
34800 KB |
Output is correct |
17 |
Correct |
1 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
4952 KB |
Output is correct |
19 |
Correct |
1 ms |
4956 KB |
Output is correct |
20 |
Correct |
1 ms |
4956 KB |
Output is correct |
21 |
Correct |
1 ms |
4952 KB |
Output is correct |
22 |
Correct |
2 ms |
4956 KB |
Output is correct |
23 |
Correct |
308 ms |
50816 KB |
Output is correct |
24 |
Correct |
2 ms |
4952 KB |
Output is correct |
25 |
Correct |
3 ms |
5212 KB |
Output is correct |
26 |
Correct |
4 ms |
5468 KB |
Output is correct |
27 |
Correct |
5 ms |
5720 KB |
Output is correct |
28 |
Correct |
112 ms |
23452 KB |
Output is correct |
29 |
Correct |
176 ms |
31852 KB |
Output is correct |
30 |
Correct |
253 ms |
42168 KB |
Output is correct |
31 |
Correct |
323 ms |
50884 KB |
Output is correct |
32 |
Correct |
1 ms |
4952 KB |
Output is correct |
33 |
Correct |
1 ms |
4952 KB |
Output is correct |
34 |
Correct |
1 ms |
4956 KB |
Output is correct |
35 |
Correct |
1 ms |
4956 KB |
Output is correct |
36 |
Correct |
1 ms |
4956 KB |
Output is correct |
37 |
Correct |
1 ms |
4956 KB |
Output is correct |
38 |
Correct |
1 ms |
4956 KB |
Output is correct |
39 |
Correct |
1 ms |
4956 KB |
Output is correct |
40 |
Correct |
1 ms |
4956 KB |
Output is correct |
41 |
Correct |
2 ms |
5212 KB |
Output is correct |
42 |
Correct |
1 ms |
4952 KB |
Output is correct |
43 |
Correct |
3 ms |
5464 KB |
Output is correct |
44 |
Correct |
4 ms |
5724 KB |
Output is correct |
45 |
Correct |
142 ms |
29792 KB |
Output is correct |
46 |
Correct |
255 ms |
41516 KB |
Output is correct |
47 |
Correct |
216 ms |
41280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4952 KB |
Output is correct |
4 |
Correct |
1 ms |
4956 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Correct |
166 ms |
34764 KB |
Output is correct |
10 |
Correct |
13 ms |
8068 KB |
Output is correct |
11 |
Correct |
75 ms |
21108 KB |
Output is correct |
12 |
Correct |
19 ms |
9564 KB |
Output is correct |
13 |
Correct |
51 ms |
15416 KB |
Output is correct |
14 |
Correct |
2 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5468 KB |
Output is correct |
16 |
Correct |
162 ms |
34800 KB |
Output is correct |
17 |
Correct |
1 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
4952 KB |
Output is correct |
19 |
Correct |
1 ms |
4956 KB |
Output is correct |
20 |
Correct |
1 ms |
4956 KB |
Output is correct |
21 |
Correct |
1 ms |
4952 KB |
Output is correct |
22 |
Correct |
2 ms |
4956 KB |
Output is correct |
23 |
Correct |
308 ms |
50816 KB |
Output is correct |
24 |
Correct |
2 ms |
4952 KB |
Output is correct |
25 |
Correct |
3 ms |
5212 KB |
Output is correct |
26 |
Correct |
4 ms |
5468 KB |
Output is correct |
27 |
Correct |
5 ms |
5720 KB |
Output is correct |
28 |
Correct |
112 ms |
23452 KB |
Output is correct |
29 |
Correct |
176 ms |
31852 KB |
Output is correct |
30 |
Correct |
253 ms |
42168 KB |
Output is correct |
31 |
Correct |
323 ms |
50884 KB |
Output is correct |
32 |
Correct |
1 ms |
4952 KB |
Output is correct |
33 |
Correct |
1 ms |
4952 KB |
Output is correct |
34 |
Correct |
1 ms |
4956 KB |
Output is correct |
35 |
Correct |
1 ms |
4956 KB |
Output is correct |
36 |
Correct |
1 ms |
4956 KB |
Output is correct |
37 |
Correct |
1 ms |
4956 KB |
Output is correct |
38 |
Correct |
1 ms |
4956 KB |
Output is correct |
39 |
Correct |
1 ms |
4956 KB |
Output is correct |
40 |
Correct |
1 ms |
4956 KB |
Output is correct |
41 |
Correct |
2 ms |
5212 KB |
Output is correct |
42 |
Correct |
1 ms |
4952 KB |
Output is correct |
43 |
Correct |
3 ms |
5464 KB |
Output is correct |
44 |
Correct |
4 ms |
5724 KB |
Output is correct |
45 |
Correct |
142 ms |
29792 KB |
Output is correct |
46 |
Correct |
255 ms |
41516 KB |
Output is correct |
47 |
Correct |
216 ms |
41280 KB |
Output is correct |
48 |
Correct |
1 ms |
4956 KB |
Output is correct |
49 |
Correct |
1 ms |
4956 KB |
Output is correct |
50 |
Correct |
1 ms |
4952 KB |
Output is correct |
51 |
Correct |
1 ms |
4952 KB |
Output is correct |
52 |
Correct |
1 ms |
4956 KB |
Output is correct |
53 |
Correct |
1 ms |
4956 KB |
Output is correct |
54 |
Correct |
1 ms |
4952 KB |
Output is correct |
55 |
Correct |
309 ms |
50040 KB |
Output is correct |
56 |
Correct |
1 ms |
4952 KB |
Output is correct |
57 |
Correct |
3 ms |
5720 KB |
Output is correct |
58 |
Correct |
9 ms |
6492 KB |
Output is correct |
59 |
Correct |
10 ms |
6756 KB |
Output is correct |
60 |
Correct |
143 ms |
27600 KB |
Output is correct |
61 |
Correct |
204 ms |
36944 KB |
Output is correct |
62 |
Correct |
260 ms |
43424 KB |
Output is correct |
63 |
Correct |
324 ms |
50300 KB |
Output is correct |
64 |
Correct |
1 ms |
4956 KB |
Output is correct |
65 |
Correct |
1 ms |
4956 KB |
Output is correct |
66 |
Correct |
1 ms |
4956 KB |
Output is correct |
67 |
Correct |
362 ms |
64768 KB |
Output is correct |
68 |
Correct |
389 ms |
65124 KB |
Output is correct |
69 |
Correct |
339 ms |
63880 KB |
Output is correct |
70 |
Correct |
5 ms |
5724 KB |
Output is correct |
71 |
Correct |
8 ms |
6492 KB |
Output is correct |
72 |
Correct |
143 ms |
29168 KB |
Output is correct |
73 |
Correct |
236 ms |
42176 KB |
Output is correct |
74 |
Correct |
328 ms |
55288 KB |
Output is correct |
75 |
Correct |
349 ms |
57008 KB |
Output is correct |
76 |
Correct |
360 ms |
64744 KB |
Output is correct |
77 |
Correct |
6 ms |
5980 KB |
Output is correct |
78 |
Correct |
9 ms |
6616 KB |
Output is correct |
79 |
Correct |
138 ms |
29708 KB |
Output is correct |
80 |
Correct |
221 ms |
42460 KB |
Output is correct |
81 |
Correct |
335 ms |
56244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4952 KB |
Output is correct |
4 |
Correct |
1 ms |
4956 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Correct |
166 ms |
34764 KB |
Output is correct |
10 |
Correct |
13 ms |
8068 KB |
Output is correct |
11 |
Correct |
75 ms |
21108 KB |
Output is correct |
12 |
Correct |
19 ms |
9564 KB |
Output is correct |
13 |
Correct |
51 ms |
15416 KB |
Output is correct |
14 |
Correct |
2 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5468 KB |
Output is correct |
16 |
Correct |
162 ms |
34800 KB |
Output is correct |
17 |
Correct |
1 ms |
4956 KB |
Output is correct |
18 |
Correct |
1 ms |
4956 KB |
Output is correct |
19 |
Correct |
2 ms |
4956 KB |
Output is correct |
20 |
Correct |
287 ms |
49892 KB |
Output is correct |
21 |
Correct |
284 ms |
49656 KB |
Output is correct |
22 |
Correct |
288 ms |
52964 KB |
Output is correct |
23 |
Correct |
290 ms |
56932 KB |
Output is correct |
24 |
Correct |
75 ms |
12880 KB |
Output is correct |
25 |
Correct |
255 ms |
50624 KB |
Output is correct |
26 |
Correct |
262 ms |
50880 KB |
Output is correct |
27 |
Correct |
294 ms |
63352 KB |
Output is correct |
28 |
Correct |
286 ms |
63356 KB |
Output is correct |
29 |
Correct |
334 ms |
63352 KB |
Output is correct |
30 |
Correct |
342 ms |
63424 KB |
Output is correct |
31 |
Correct |
1 ms |
4956 KB |
Output is correct |
32 |
Correct |
21 ms |
8700 KB |
Output is correct |
33 |
Correct |
30 ms |
9008 KB |
Output is correct |
34 |
Correct |
286 ms |
50772 KB |
Output is correct |
35 |
Correct |
13 ms |
6740 KB |
Output is correct |
36 |
Correct |
55 ms |
13620 KB |
Output is correct |
37 |
Correct |
117 ms |
22152 KB |
Output is correct |
38 |
Correct |
126 ms |
24072 KB |
Output is correct |
39 |
Correct |
183 ms |
30856 KB |
Output is correct |
40 |
Correct |
253 ms |
38580 KB |
Output is correct |
41 |
Correct |
330 ms |
45264 KB |
Output is correct |
42 |
Correct |
377 ms |
52080 KB |
Output is correct |
43 |
Correct |
1 ms |
4956 KB |
Output is correct |
44 |
Correct |
1 ms |
4956 KB |
Output is correct |
45 |
Correct |
1 ms |
4956 KB |
Output is correct |
46 |
Correct |
1 ms |
4956 KB |
Output is correct |
47 |
Correct |
1 ms |
4956 KB |
Output is correct |
48 |
Correct |
1 ms |
4956 KB |
Output is correct |
49 |
Correct |
1 ms |
4956 KB |
Output is correct |
50 |
Correct |
2 ms |
4956 KB |
Output is correct |
51 |
Correct |
1 ms |
4956 KB |
Output is correct |
52 |
Correct |
1 ms |
4956 KB |
Output is correct |
53 |
Correct |
1 ms |
4956 KB |
Output is correct |
54 |
Correct |
3 ms |
5468 KB |
Output is correct |
55 |
Correct |
4 ms |
5724 KB |
Output is correct |
56 |
Correct |
153 ms |
29764 KB |
Output is correct |
57 |
Correct |
220 ms |
41212 KB |
Output is correct |
58 |
Correct |
228 ms |
41380 KB |
Output is correct |
59 |
Correct |
1 ms |
4952 KB |
Output is correct |
60 |
Correct |
1 ms |
4956 KB |
Output is correct |
61 |
Correct |
1 ms |
4956 KB |
Output is correct |
62 |
Correct |
360 ms |
64884 KB |
Output is correct |
63 |
Correct |
361 ms |
65144 KB |
Output is correct |
64 |
Correct |
347 ms |
63876 KB |
Output is correct |
65 |
Correct |
5 ms |
5720 KB |
Output is correct |
66 |
Correct |
9 ms |
6688 KB |
Output is correct |
67 |
Correct |
147 ms |
29244 KB |
Output is correct |
68 |
Correct |
226 ms |
42276 KB |
Output is correct |
69 |
Correct |
313 ms |
53784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4952 KB |
Output is correct |
4 |
Correct |
1 ms |
4956 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Correct |
166 ms |
34764 KB |
Output is correct |
10 |
Correct |
13 ms |
8068 KB |
Output is correct |
11 |
Correct |
75 ms |
21108 KB |
Output is correct |
12 |
Correct |
19 ms |
9564 KB |
Output is correct |
13 |
Correct |
51 ms |
15416 KB |
Output is correct |
14 |
Correct |
2 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5468 KB |
Output is correct |
16 |
Correct |
162 ms |
34800 KB |
Output is correct |
17 |
Correct |
378 ms |
65156 KB |
Output is correct |
18 |
Correct |
380 ms |
65392 KB |
Output is correct |
19 |
Correct |
325 ms |
50936 KB |
Output is correct |
20 |
Correct |
280 ms |
52492 KB |
Output is correct |
21 |
Correct |
296 ms |
55184 KB |
Output is correct |
22 |
Correct |
2 ms |
4952 KB |
Output is correct |
23 |
Correct |
44 ms |
13012 KB |
Output is correct |
24 |
Correct |
22 ms |
8660 KB |
Output is correct |
25 |
Correct |
79 ms |
17688 KB |
Output is correct |
26 |
Correct |
157 ms |
26440 KB |
Output is correct |
27 |
Correct |
164 ms |
29532 KB |
Output is correct |
28 |
Correct |
203 ms |
35852 KB |
Output is correct |
29 |
Correct |
263 ms |
42164 KB |
Output is correct |
30 |
Correct |
323 ms |
47596 KB |
Output is correct |
31 |
Correct |
357 ms |
53600 KB |
Output is correct |
32 |
Correct |
376 ms |
56984 KB |
Output is correct |
33 |
Correct |
359 ms |
65248 KB |
Output is correct |
34 |
Correct |
6 ms |
5976 KB |
Output is correct |
35 |
Correct |
13 ms |
6748 KB |
Output is correct |
36 |
Correct |
151 ms |
29748 KB |
Output is correct |
37 |
Correct |
233 ms |
42464 KB |
Output is correct |
38 |
Correct |
332 ms |
55020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4952 KB |
Output is correct |
4 |
Correct |
1 ms |
4956 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Correct |
166 ms |
34764 KB |
Output is correct |
10 |
Correct |
13 ms |
8068 KB |
Output is correct |
11 |
Correct |
75 ms |
21108 KB |
Output is correct |
12 |
Correct |
19 ms |
9564 KB |
Output is correct |
13 |
Correct |
51 ms |
15416 KB |
Output is correct |
14 |
Correct |
2 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5468 KB |
Output is correct |
16 |
Correct |
162 ms |
34800 KB |
Output is correct |
17 |
Correct |
1 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
4952 KB |
Output is correct |
19 |
Correct |
1 ms |
4956 KB |
Output is correct |
20 |
Correct |
1 ms |
4956 KB |
Output is correct |
21 |
Correct |
1 ms |
4952 KB |
Output is correct |
22 |
Correct |
2 ms |
4956 KB |
Output is correct |
23 |
Correct |
308 ms |
50816 KB |
Output is correct |
24 |
Correct |
2 ms |
4952 KB |
Output is correct |
25 |
Correct |
3 ms |
5212 KB |
Output is correct |
26 |
Correct |
4 ms |
5468 KB |
Output is correct |
27 |
Correct |
5 ms |
5720 KB |
Output is correct |
28 |
Correct |
112 ms |
23452 KB |
Output is correct |
29 |
Correct |
176 ms |
31852 KB |
Output is correct |
30 |
Correct |
253 ms |
42168 KB |
Output is correct |
31 |
Correct |
323 ms |
50884 KB |
Output is correct |
32 |
Correct |
1 ms |
4952 KB |
Output is correct |
33 |
Correct |
1 ms |
4952 KB |
Output is correct |
34 |
Correct |
1 ms |
4956 KB |
Output is correct |
35 |
Correct |
1 ms |
4956 KB |
Output is correct |
36 |
Correct |
1 ms |
4956 KB |
Output is correct |
37 |
Correct |
1 ms |
4956 KB |
Output is correct |
38 |
Correct |
1 ms |
4956 KB |
Output is correct |
39 |
Correct |
1 ms |
4956 KB |
Output is correct |
40 |
Correct |
1 ms |
4956 KB |
Output is correct |
41 |
Correct |
2 ms |
5212 KB |
Output is correct |
42 |
Correct |
1 ms |
4952 KB |
Output is correct |
43 |
Correct |
3 ms |
5464 KB |
Output is correct |
44 |
Correct |
4 ms |
5724 KB |
Output is correct |
45 |
Correct |
142 ms |
29792 KB |
Output is correct |
46 |
Correct |
255 ms |
41516 KB |
Output is correct |
47 |
Correct |
216 ms |
41280 KB |
Output is correct |
48 |
Correct |
1 ms |
4956 KB |
Output is correct |
49 |
Correct |
1 ms |
4956 KB |
Output is correct |
50 |
Correct |
1 ms |
4952 KB |
Output is correct |
51 |
Correct |
1 ms |
4952 KB |
Output is correct |
52 |
Correct |
1 ms |
4956 KB |
Output is correct |
53 |
Correct |
1 ms |
4956 KB |
Output is correct |
54 |
Correct |
1 ms |
4952 KB |
Output is correct |
55 |
Correct |
309 ms |
50040 KB |
Output is correct |
56 |
Correct |
1 ms |
4952 KB |
Output is correct |
57 |
Correct |
3 ms |
5720 KB |
Output is correct |
58 |
Correct |
9 ms |
6492 KB |
Output is correct |
59 |
Correct |
10 ms |
6756 KB |
Output is correct |
60 |
Correct |
143 ms |
27600 KB |
Output is correct |
61 |
Correct |
204 ms |
36944 KB |
Output is correct |
62 |
Correct |
260 ms |
43424 KB |
Output is correct |
63 |
Correct |
324 ms |
50300 KB |
Output is correct |
64 |
Correct |
1 ms |
4956 KB |
Output is correct |
65 |
Correct |
1 ms |
4956 KB |
Output is correct |
66 |
Correct |
1 ms |
4956 KB |
Output is correct |
67 |
Correct |
362 ms |
64768 KB |
Output is correct |
68 |
Correct |
389 ms |
65124 KB |
Output is correct |
69 |
Correct |
339 ms |
63880 KB |
Output is correct |
70 |
Correct |
5 ms |
5724 KB |
Output is correct |
71 |
Correct |
8 ms |
6492 KB |
Output is correct |
72 |
Correct |
143 ms |
29168 KB |
Output is correct |
73 |
Correct |
236 ms |
42176 KB |
Output is correct |
74 |
Correct |
328 ms |
55288 KB |
Output is correct |
75 |
Correct |
349 ms |
57008 KB |
Output is correct |
76 |
Correct |
360 ms |
64744 KB |
Output is correct |
77 |
Correct |
6 ms |
5980 KB |
Output is correct |
78 |
Correct |
9 ms |
6616 KB |
Output is correct |
79 |
Correct |
138 ms |
29708 KB |
Output is correct |
80 |
Correct |
221 ms |
42460 KB |
Output is correct |
81 |
Correct |
335 ms |
56244 KB |
Output is correct |
82 |
Correct |
1 ms |
4956 KB |
Output is correct |
83 |
Correct |
1 ms |
4956 KB |
Output is correct |
84 |
Correct |
2 ms |
4956 KB |
Output is correct |
85 |
Correct |
287 ms |
49892 KB |
Output is correct |
86 |
Correct |
284 ms |
49656 KB |
Output is correct |
87 |
Correct |
288 ms |
52964 KB |
Output is correct |
88 |
Correct |
290 ms |
56932 KB |
Output is correct |
89 |
Correct |
75 ms |
12880 KB |
Output is correct |
90 |
Correct |
255 ms |
50624 KB |
Output is correct |
91 |
Correct |
262 ms |
50880 KB |
Output is correct |
92 |
Correct |
294 ms |
63352 KB |
Output is correct |
93 |
Correct |
286 ms |
63356 KB |
Output is correct |
94 |
Correct |
334 ms |
63352 KB |
Output is correct |
95 |
Correct |
342 ms |
63424 KB |
Output is correct |
96 |
Correct |
1 ms |
4956 KB |
Output is correct |
97 |
Correct |
21 ms |
8700 KB |
Output is correct |
98 |
Correct |
30 ms |
9008 KB |
Output is correct |
99 |
Correct |
286 ms |
50772 KB |
Output is correct |
100 |
Correct |
13 ms |
6740 KB |
Output is correct |
101 |
Correct |
55 ms |
13620 KB |
Output is correct |
102 |
Correct |
117 ms |
22152 KB |
Output is correct |
103 |
Correct |
126 ms |
24072 KB |
Output is correct |
104 |
Correct |
183 ms |
30856 KB |
Output is correct |
105 |
Correct |
253 ms |
38580 KB |
Output is correct |
106 |
Correct |
330 ms |
45264 KB |
Output is correct |
107 |
Correct |
377 ms |
52080 KB |
Output is correct |
108 |
Correct |
1 ms |
4956 KB |
Output is correct |
109 |
Correct |
1 ms |
4956 KB |
Output is correct |
110 |
Correct |
1 ms |
4956 KB |
Output is correct |
111 |
Correct |
1 ms |
4956 KB |
Output is correct |
112 |
Correct |
1 ms |
4956 KB |
Output is correct |
113 |
Correct |
1 ms |
4956 KB |
Output is correct |
114 |
Correct |
1 ms |
4956 KB |
Output is correct |
115 |
Correct |
2 ms |
4956 KB |
Output is correct |
116 |
Correct |
1 ms |
4956 KB |
Output is correct |
117 |
Correct |
1 ms |
4956 KB |
Output is correct |
118 |
Correct |
1 ms |
4956 KB |
Output is correct |
119 |
Correct |
3 ms |
5468 KB |
Output is correct |
120 |
Correct |
4 ms |
5724 KB |
Output is correct |
121 |
Correct |
153 ms |
29764 KB |
Output is correct |
122 |
Correct |
220 ms |
41212 KB |
Output is correct |
123 |
Correct |
228 ms |
41380 KB |
Output is correct |
124 |
Correct |
1 ms |
4952 KB |
Output is correct |
125 |
Correct |
1 ms |
4956 KB |
Output is correct |
126 |
Correct |
1 ms |
4956 KB |
Output is correct |
127 |
Correct |
360 ms |
64884 KB |
Output is correct |
128 |
Correct |
361 ms |
65144 KB |
Output is correct |
129 |
Correct |
347 ms |
63876 KB |
Output is correct |
130 |
Correct |
5 ms |
5720 KB |
Output is correct |
131 |
Correct |
9 ms |
6688 KB |
Output is correct |
132 |
Correct |
147 ms |
29244 KB |
Output is correct |
133 |
Correct |
226 ms |
42276 KB |
Output is correct |
134 |
Correct |
313 ms |
53784 KB |
Output is correct |
135 |
Correct |
378 ms |
65156 KB |
Output is correct |
136 |
Correct |
380 ms |
65392 KB |
Output is correct |
137 |
Correct |
325 ms |
50936 KB |
Output is correct |
138 |
Correct |
280 ms |
52492 KB |
Output is correct |
139 |
Correct |
296 ms |
55184 KB |
Output is correct |
140 |
Correct |
2 ms |
4952 KB |
Output is correct |
141 |
Correct |
44 ms |
13012 KB |
Output is correct |
142 |
Correct |
22 ms |
8660 KB |
Output is correct |
143 |
Correct |
79 ms |
17688 KB |
Output is correct |
144 |
Correct |
157 ms |
26440 KB |
Output is correct |
145 |
Correct |
164 ms |
29532 KB |
Output is correct |
146 |
Correct |
203 ms |
35852 KB |
Output is correct |
147 |
Correct |
263 ms |
42164 KB |
Output is correct |
148 |
Correct |
323 ms |
47596 KB |
Output is correct |
149 |
Correct |
357 ms |
53600 KB |
Output is correct |
150 |
Correct |
376 ms |
56984 KB |
Output is correct |
151 |
Correct |
359 ms |
65248 KB |
Output is correct |
152 |
Correct |
6 ms |
5976 KB |
Output is correct |
153 |
Correct |
13 ms |
6748 KB |
Output is correct |
154 |
Correct |
151 ms |
29748 KB |
Output is correct |
155 |
Correct |
233 ms |
42464 KB |
Output is correct |
156 |
Correct |
332 ms |
55020 KB |
Output is correct |
157 |
Correct |
3 ms |
4952 KB |
Output is correct |
158 |
Correct |
1 ms |
4956 KB |
Output is correct |
159 |
Correct |
1 ms |
4956 KB |
Output is correct |
160 |
Correct |
2 ms |
4952 KB |
Output is correct |
161 |
Correct |
289 ms |
49260 KB |
Output is correct |
162 |
Correct |
277 ms |
49908 KB |
Output is correct |
163 |
Correct |
258 ms |
50408 KB |
Output is correct |
164 |
Correct |
262 ms |
50004 KB |
Output is correct |
165 |
Correct |
267 ms |
49460 KB |
Output is correct |
166 |
Correct |
263 ms |
48956 KB |
Output is correct |
167 |
Incorrect |
54 ms |
13608 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |