#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<pair<int,int>,int> pp;
int n;
///bench position
int bench_lr[200010]={},bench_ba[200010]={};
///above,below,left,right;
int a[200010],b[200010],l[200010],r[200010];
///sort to get a b l r
vector<pp> fo,fo2;
///go back to find links: traceback above and below (get the x coor)
int trace_a[200010],trace_b[200010];
///to get potential connected links (that shouldn't collide)
int cur_y[200010],cur_x[200010];
vector<pair<int,bool>> link;
vector<int> adj[400010];
int chosen[400010]={};
///check if every fountains are connected
vector<int> adj2[200010];
void changebench(int x)
{
if(x<0) return;
if(a[x]<0) return;
int temp=x;
while(temp>=0 && a[temp]>=0 && bench_lr[temp]==-1)
{
bench_lr[temp]=1;
temp=r[temp];
}
}
void dfs(int v,int col)
{
chosen[v]=col;
for(int i=0;i<adj[v].size();i++)
{
if(!chosen[adj[v][i]]) dfs(adj[v][i],3-col);
}
}
int cou=0;
bool visited[200010]={};
void dfs_check(int v)
{
cou++;
for(int i=0;i<adj2[v].size();i++)
{
if(visited[adj2[v][i]]) continue;
visited[adj2[v][i]]=true;
dfs_check(adj2[v][i]);
}
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
n=x.size();
for(int i=0;i<n;i++)
{
fo.push_back({{x[i],y[i]},i});
fo2.push_back({{y[i],x[i]},i});
a[i]=-1;
b[i]=-1;
l[i]=-1;
r[i]=-1;
}
for(int i=0;i<200010;i++) cur_x[i]=cur_y[i]=-2;
sort(fo.begin(),fo.end());
sort(fo2.begin(),fo2.end());
for(int i=0;i<n-1;i++)
{
if(fo[i].first.first==fo[i+1].first.first && fo[i].first.second==fo[i+1].first.second-2)
{
a[fo[i].second]=fo[i+1].second;
b[fo[i+1].second]=fo[i].second;
bench_lr[fo[i].second]=-1;
}
}
for(int i=0;i<n-1;i++)
{
if(fo2[i].first.first==fo2[i+1].first.first && fo2[i].first.second==fo2[i+1].first.second-2)
{
r[fo2[i].second]=fo2[i+1].second;
l[fo2[i+1].second]=fo2[i].second;
}
}
for(int i=0;i<n;i++)
{
if(a[i]>=0) adj2[i].push_back(a[i]);
if(b[i]>=0) adj2[i].push_back(b[i]);
if(l[i]>=0) adj2[i].push_back(l[i]);
if(r[i]>=0) adj2[i].push_back(r[i]);
}
visited[0]=true;
dfs_check(0);
if(cou<n) return 0;
int temp;
for(int i=0;i<n-1;i++)
{
temp=fo[i].second;
if(a[temp]<0)
{
trace_a[temp]=x[temp]+1;
}
else
{
if(l[temp]<0)
{
trace_a[temp]=x[temp]-1;
}
else
{
trace_a[temp]=trace_a[l[temp]];
}
}
if(b[temp]<0)
{
trace_b[temp]=x[temp]+1;
}
else
{
if(l[temp]<0) trace_b[temp]=x[temp]-1;
else trace_b[temp]=trace_b[l[temp]];
}
}
int temp2;
for(int i=0;i<n;i++)
{
temp=fo[i].second;
if(r[temp]<0) continue;
if(b[temp]<0 || b[r[temp]]<0)
{
link.push_back({temp,false});
if(cur_y[y[temp]-1]>=0)
{
temp2=link[cur_y[y[temp]-1]].first;
if(trace_b[temp]<=x[temp2]+1)
{
adj[link.size()-1].push_back(cur_y[y[temp]-1]);
adj[cur_y[y[temp]-1]].push_back(link.size()-1);
}
}
cur_y[y[temp]-1]=link.size()-1;
cur_x[x[temp]+1]=link.size()-1;
}
if(a[temp]<0 || a[r[temp]]<0)
{
link.push_back({temp,true});
if(cur_y[y[temp]+1]>=0)
{
temp2=link[cur_y[y[temp]+1]].first;
if(trace_a[temp]<=x[temp2]+1)
{
adj[link.size()-1].push_back(cur_y[y[temp]+1]);
adj[cur_y[y[temp]+1]].push_back(link.size()-1);
}
}
cur_y[y[temp]+1]=link.size()-1;
adj[link.size()-1].push_back(cur_x[x[temp]+1]);
adj[cur_x[x[temp]+1]].push_back(link.size()-1);
cur_x[x[temp]+1]=link.size()-1;
}
}
for(int i=0;i<link.size();i++)
{
if(chosen[i]) continue;
dfs(i,1);
}
for(int i=0;i<link.size();i++)
{
if(chosen[i]==2)
{
temp=link[i].first;
if(link[i].second)
{
bench_ba[temp]=1;
changebench(r[temp]);
}
else
{
bench_ba[temp]=-1;
changebench(b[r[temp]]);
}
}
}
vector<int> u,v,aa,bb;
for(int i=0;i<n;i++)
{
if(bench_lr[i])
{
u.push_back(i);
v.push_back(a[i]);
aa.push_back(x[i]+bench_lr[i]);
bb.push_back(y[i]+1);
}
if(bench_ba[i])
{
u.push_back(i);
v.push_back(r[i]);
aa.push_back(x[i]+1);
bb.push_back(y[i]+bench_ba[i]);
}
}
build(u,v,aa,bb);
return 1;
}
Compilation message
parks.cpp: In function 'void dfs(int, int)':
parks.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | for(int i=0;i<adj[v].size();i++)
| ~^~~~~~~~~~~~~~
parks.cpp: In function 'void dfs_check(int)':
parks.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for(int i=0;i<adj2[v].size();i++)
| ~^~~~~~~~~~~~~~~
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:170:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
170 | for(int i=0;i<link.size();i++)
| ~^~~~~~~~~~~~
parks.cpp:175:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
175 | for(int i=0;i<link.size();i++)
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14368 KB |
Output is correct |
2 |
Correct |
11 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
11 ms |
15948 KB |
Output is correct |
5 |
Correct |
12 ms |
15948 KB |
Output is correct |
6 |
Correct |
11 ms |
15948 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
12 ms |
15928 KB |
Output is correct |
9 |
Correct |
175 ms |
36416 KB |
Output is correct |
10 |
Correct |
20 ms |
18124 KB |
Output is correct |
11 |
Correct |
62 ms |
27108 KB |
Output is correct |
12 |
Correct |
25 ms |
19116 KB |
Output is correct |
13 |
Correct |
32 ms |
21436 KB |
Output is correct |
14 |
Correct |
12 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
124 ms |
34512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14368 KB |
Output is correct |
2 |
Correct |
11 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
11 ms |
15948 KB |
Output is correct |
5 |
Correct |
12 ms |
15948 KB |
Output is correct |
6 |
Correct |
11 ms |
15948 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
12 ms |
15928 KB |
Output is correct |
9 |
Correct |
175 ms |
36416 KB |
Output is correct |
10 |
Correct |
20 ms |
18124 KB |
Output is correct |
11 |
Correct |
62 ms |
27108 KB |
Output is correct |
12 |
Correct |
25 ms |
19116 KB |
Output is correct |
13 |
Correct |
32 ms |
21436 KB |
Output is correct |
14 |
Correct |
12 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
124 ms |
34512 KB |
Output is correct |
17 |
Correct |
11 ms |
15952 KB |
Output is correct |
18 |
Correct |
11 ms |
15948 KB |
Output is correct |
19 |
Correct |
12 ms |
15948 KB |
Output is correct |
20 |
Correct |
14 ms |
15948 KB |
Output is correct |
21 |
Correct |
13 ms |
15996 KB |
Output is correct |
22 |
Correct |
15 ms |
15904 KB |
Output is correct |
23 |
Correct |
297 ms |
57980 KB |
Output is correct |
24 |
Correct |
12 ms |
15948 KB |
Output is correct |
25 |
Correct |
12 ms |
16204 KB |
Output is correct |
26 |
Correct |
14 ms |
16332 KB |
Output is correct |
27 |
Correct |
16 ms |
16400 KB |
Output is correct |
28 |
Correct |
109 ms |
33076 KB |
Output is correct |
29 |
Correct |
166 ms |
40872 KB |
Output is correct |
30 |
Correct |
238 ms |
50108 KB |
Output is correct |
31 |
Correct |
304 ms |
57856 KB |
Output is correct |
32 |
Correct |
11 ms |
15948 KB |
Output is correct |
33 |
Correct |
12 ms |
16076 KB |
Output is correct |
34 |
Correct |
10 ms |
15948 KB |
Output is correct |
35 |
Correct |
11 ms |
15988 KB |
Output is correct |
36 |
Correct |
12 ms |
15948 KB |
Output is correct |
37 |
Correct |
11 ms |
15956 KB |
Output is correct |
38 |
Correct |
11 ms |
15948 KB |
Output is correct |
39 |
Correct |
11 ms |
15948 KB |
Output is correct |
40 |
Correct |
11 ms |
15932 KB |
Output is correct |
41 |
Correct |
11 ms |
15880 KB |
Output is correct |
42 |
Correct |
11 ms |
15948 KB |
Output is correct |
43 |
Correct |
12 ms |
16204 KB |
Output is correct |
44 |
Correct |
13 ms |
16204 KB |
Output is correct |
45 |
Correct |
150 ms |
38096 KB |
Output is correct |
46 |
Correct |
222 ms |
49332 KB |
Output is correct |
47 |
Correct |
221 ms |
49108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14368 KB |
Output is correct |
2 |
Correct |
11 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
11 ms |
15948 KB |
Output is correct |
5 |
Correct |
12 ms |
15948 KB |
Output is correct |
6 |
Correct |
11 ms |
15948 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
12 ms |
15928 KB |
Output is correct |
9 |
Correct |
175 ms |
36416 KB |
Output is correct |
10 |
Correct |
20 ms |
18124 KB |
Output is correct |
11 |
Correct |
62 ms |
27108 KB |
Output is correct |
12 |
Correct |
25 ms |
19116 KB |
Output is correct |
13 |
Correct |
32 ms |
21436 KB |
Output is correct |
14 |
Correct |
12 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
124 ms |
34512 KB |
Output is correct |
17 |
Correct |
11 ms |
15952 KB |
Output is correct |
18 |
Correct |
11 ms |
15948 KB |
Output is correct |
19 |
Correct |
12 ms |
15948 KB |
Output is correct |
20 |
Correct |
14 ms |
15948 KB |
Output is correct |
21 |
Correct |
13 ms |
15996 KB |
Output is correct |
22 |
Correct |
15 ms |
15904 KB |
Output is correct |
23 |
Correct |
297 ms |
57980 KB |
Output is correct |
24 |
Correct |
12 ms |
15948 KB |
Output is correct |
25 |
Correct |
12 ms |
16204 KB |
Output is correct |
26 |
Correct |
14 ms |
16332 KB |
Output is correct |
27 |
Correct |
16 ms |
16400 KB |
Output is correct |
28 |
Correct |
109 ms |
33076 KB |
Output is correct |
29 |
Correct |
166 ms |
40872 KB |
Output is correct |
30 |
Correct |
238 ms |
50108 KB |
Output is correct |
31 |
Correct |
304 ms |
57856 KB |
Output is correct |
32 |
Correct |
11 ms |
15948 KB |
Output is correct |
33 |
Correct |
12 ms |
16076 KB |
Output is correct |
34 |
Correct |
10 ms |
15948 KB |
Output is correct |
35 |
Correct |
11 ms |
15988 KB |
Output is correct |
36 |
Correct |
12 ms |
15948 KB |
Output is correct |
37 |
Correct |
11 ms |
15956 KB |
Output is correct |
38 |
Correct |
11 ms |
15948 KB |
Output is correct |
39 |
Correct |
11 ms |
15948 KB |
Output is correct |
40 |
Correct |
11 ms |
15932 KB |
Output is correct |
41 |
Correct |
11 ms |
15880 KB |
Output is correct |
42 |
Correct |
11 ms |
15948 KB |
Output is correct |
43 |
Correct |
12 ms |
16204 KB |
Output is correct |
44 |
Correct |
13 ms |
16204 KB |
Output is correct |
45 |
Correct |
150 ms |
38096 KB |
Output is correct |
46 |
Correct |
222 ms |
49332 KB |
Output is correct |
47 |
Correct |
221 ms |
49108 KB |
Output is correct |
48 |
Correct |
11 ms |
15948 KB |
Output is correct |
49 |
Correct |
10 ms |
15948 KB |
Output is correct |
50 |
Correct |
13 ms |
15948 KB |
Output is correct |
51 |
Correct |
13 ms |
15996 KB |
Output is correct |
52 |
Correct |
11 ms |
15948 KB |
Output is correct |
53 |
Correct |
11 ms |
15948 KB |
Output is correct |
54 |
Correct |
12 ms |
15948 KB |
Output is correct |
55 |
Correct |
288 ms |
55656 KB |
Output is correct |
56 |
Correct |
10 ms |
15948 KB |
Output is correct |
57 |
Correct |
14 ms |
16332 KB |
Output is correct |
58 |
Correct |
17 ms |
17272 KB |
Output is correct |
59 |
Correct |
17 ms |
16972 KB |
Output is correct |
60 |
Correct |
149 ms |
36832 KB |
Output is correct |
61 |
Correct |
190 ms |
44972 KB |
Output is correct |
62 |
Correct |
237 ms |
49216 KB |
Output is correct |
63 |
Correct |
295 ms |
56912 KB |
Output is correct |
64 |
Correct |
13 ms |
15948 KB |
Output is correct |
65 |
Correct |
13 ms |
15948 KB |
Output is correct |
66 |
Correct |
10 ms |
15948 KB |
Output is correct |
67 |
Correct |
265 ms |
55220 KB |
Output is correct |
68 |
Correct |
287 ms |
55296 KB |
Output is correct |
69 |
Correct |
274 ms |
56328 KB |
Output is correct |
70 |
Correct |
16 ms |
16332 KB |
Output is correct |
71 |
Correct |
14 ms |
16788 KB |
Output is correct |
72 |
Correct |
158 ms |
37584 KB |
Output is correct |
73 |
Correct |
264 ms |
49800 KB |
Output is correct |
74 |
Correct |
310 ms |
59684 KB |
Output is correct |
75 |
Correct |
328 ms |
66864 KB |
Output is correct |
76 |
Correct |
322 ms |
57984 KB |
Output is correct |
77 |
Correct |
16 ms |
16460 KB |
Output is correct |
78 |
Correct |
16 ms |
16912 KB |
Output is correct |
79 |
Correct |
151 ms |
38708 KB |
Output is correct |
80 |
Correct |
278 ms |
50720 KB |
Output is correct |
81 |
Correct |
359 ms |
62112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14368 KB |
Output is correct |
2 |
Correct |
11 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
11 ms |
15948 KB |
Output is correct |
5 |
Correct |
12 ms |
15948 KB |
Output is correct |
6 |
Correct |
11 ms |
15948 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
12 ms |
15928 KB |
Output is correct |
9 |
Correct |
175 ms |
36416 KB |
Output is correct |
10 |
Correct |
20 ms |
18124 KB |
Output is correct |
11 |
Correct |
62 ms |
27108 KB |
Output is correct |
12 |
Correct |
25 ms |
19116 KB |
Output is correct |
13 |
Correct |
32 ms |
21436 KB |
Output is correct |
14 |
Correct |
12 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
124 ms |
34512 KB |
Output is correct |
17 |
Correct |
11 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
11 ms |
15948 KB |
Output is correct |
20 |
Correct |
386 ms |
68204 KB |
Output is correct |
21 |
Correct |
359 ms |
66180 KB |
Output is correct |
22 |
Correct |
356 ms |
64896 KB |
Output is correct |
23 |
Correct |
278 ms |
59680 KB |
Output is correct |
24 |
Correct |
133 ms |
27072 KB |
Output is correct |
25 |
Correct |
130 ms |
33356 KB |
Output is correct |
26 |
Correct |
129 ms |
34156 KB |
Output is correct |
27 |
Correct |
267 ms |
49412 KB |
Output is correct |
28 |
Correct |
269 ms |
49412 KB |
Output is correct |
29 |
Correct |
318 ms |
66536 KB |
Output is correct |
30 |
Correct |
350 ms |
66516 KB |
Output is correct |
31 |
Correct |
12 ms |
15948 KB |
Output is correct |
32 |
Correct |
29 ms |
19344 KB |
Output is correct |
33 |
Correct |
68 ms |
21580 KB |
Output is correct |
34 |
Correct |
348 ms |
68260 KB |
Output is correct |
35 |
Correct |
18 ms |
16844 KB |
Output is correct |
36 |
Correct |
43 ms |
20552 KB |
Output is correct |
37 |
Correct |
80 ms |
25068 KB |
Output is correct |
38 |
Correct |
133 ms |
33400 KB |
Output is correct |
39 |
Correct |
179 ms |
39280 KB |
Output is correct |
40 |
Correct |
288 ms |
47148 KB |
Output is correct |
41 |
Correct |
294 ms |
53040 KB |
Output is correct |
42 |
Correct |
363 ms |
59020 KB |
Output is correct |
43 |
Correct |
10 ms |
15948 KB |
Output is correct |
44 |
Correct |
14 ms |
15944 KB |
Output is correct |
45 |
Correct |
11 ms |
15948 KB |
Output is correct |
46 |
Correct |
12 ms |
15948 KB |
Output is correct |
47 |
Correct |
13 ms |
15988 KB |
Output is correct |
48 |
Correct |
12 ms |
15972 KB |
Output is correct |
49 |
Correct |
12 ms |
15948 KB |
Output is correct |
50 |
Correct |
11 ms |
15948 KB |
Output is correct |
51 |
Correct |
11 ms |
15948 KB |
Output is correct |
52 |
Correct |
11 ms |
16040 KB |
Output is correct |
53 |
Correct |
13 ms |
15948 KB |
Output is correct |
54 |
Correct |
12 ms |
16160 KB |
Output is correct |
55 |
Correct |
15 ms |
16332 KB |
Output is correct |
56 |
Correct |
147 ms |
38200 KB |
Output is correct |
57 |
Correct |
221 ms |
49340 KB |
Output is correct |
58 |
Correct |
261 ms |
49060 KB |
Output is correct |
59 |
Correct |
11 ms |
15948 KB |
Output is correct |
60 |
Correct |
11 ms |
15948 KB |
Output is correct |
61 |
Correct |
12 ms |
15976 KB |
Output is correct |
62 |
Correct |
274 ms |
55216 KB |
Output is correct |
63 |
Correct |
331 ms |
55328 KB |
Output is correct |
64 |
Correct |
281 ms |
56328 KB |
Output is correct |
65 |
Correct |
14 ms |
16356 KB |
Output is correct |
66 |
Correct |
15 ms |
16672 KB |
Output is correct |
67 |
Correct |
145 ms |
37700 KB |
Output is correct |
68 |
Correct |
248 ms |
50004 KB |
Output is correct |
69 |
Correct |
366 ms |
59792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14368 KB |
Output is correct |
2 |
Correct |
11 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
11 ms |
15948 KB |
Output is correct |
5 |
Correct |
12 ms |
15948 KB |
Output is correct |
6 |
Correct |
11 ms |
15948 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
12 ms |
15928 KB |
Output is correct |
9 |
Correct |
175 ms |
36416 KB |
Output is correct |
10 |
Correct |
20 ms |
18124 KB |
Output is correct |
11 |
Correct |
62 ms |
27108 KB |
Output is correct |
12 |
Correct |
25 ms |
19116 KB |
Output is correct |
13 |
Correct |
32 ms |
21436 KB |
Output is correct |
14 |
Correct |
12 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
124 ms |
34512 KB |
Output is correct |
17 |
Correct |
347 ms |
67688 KB |
Output is correct |
18 |
Correct |
345 ms |
66900 KB |
Output is correct |
19 |
Correct |
348 ms |
68096 KB |
Output is correct |
20 |
Correct |
361 ms |
68176 KB |
Output is correct |
21 |
Correct |
302 ms |
58432 KB |
Output is correct |
22 |
Correct |
12 ms |
15896 KB |
Output is correct |
23 |
Correct |
56 ms |
23736 KB |
Output is correct |
24 |
Correct |
26 ms |
17988 KB |
Output is correct |
25 |
Correct |
61 ms |
22572 KB |
Output is correct |
26 |
Correct |
100 ms |
27104 KB |
Output is correct |
27 |
Correct |
182 ms |
41244 KB |
Output is correct |
28 |
Correct |
232 ms |
49276 KB |
Output is correct |
29 |
Correct |
361 ms |
55236 KB |
Output is correct |
30 |
Correct |
369 ms |
60768 KB |
Output is correct |
31 |
Correct |
421 ms |
67132 KB |
Output is correct |
32 |
Correct |
360 ms |
66792 KB |
Output is correct |
33 |
Correct |
295 ms |
57936 KB |
Output is correct |
34 |
Correct |
14 ms |
16460 KB |
Output is correct |
35 |
Correct |
20 ms |
16868 KB |
Output is correct |
36 |
Correct |
185 ms |
38732 KB |
Output is correct |
37 |
Correct |
237 ms |
50696 KB |
Output is correct |
38 |
Correct |
324 ms |
62116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14368 KB |
Output is correct |
2 |
Correct |
11 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
11 ms |
15948 KB |
Output is correct |
5 |
Correct |
12 ms |
15948 KB |
Output is correct |
6 |
Correct |
11 ms |
15948 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
12 ms |
15928 KB |
Output is correct |
9 |
Correct |
175 ms |
36416 KB |
Output is correct |
10 |
Correct |
20 ms |
18124 KB |
Output is correct |
11 |
Correct |
62 ms |
27108 KB |
Output is correct |
12 |
Correct |
25 ms |
19116 KB |
Output is correct |
13 |
Correct |
32 ms |
21436 KB |
Output is correct |
14 |
Correct |
12 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
124 ms |
34512 KB |
Output is correct |
17 |
Correct |
11 ms |
15952 KB |
Output is correct |
18 |
Correct |
11 ms |
15948 KB |
Output is correct |
19 |
Correct |
12 ms |
15948 KB |
Output is correct |
20 |
Correct |
14 ms |
15948 KB |
Output is correct |
21 |
Correct |
13 ms |
15996 KB |
Output is correct |
22 |
Correct |
15 ms |
15904 KB |
Output is correct |
23 |
Correct |
297 ms |
57980 KB |
Output is correct |
24 |
Correct |
12 ms |
15948 KB |
Output is correct |
25 |
Correct |
12 ms |
16204 KB |
Output is correct |
26 |
Correct |
14 ms |
16332 KB |
Output is correct |
27 |
Correct |
16 ms |
16400 KB |
Output is correct |
28 |
Correct |
109 ms |
33076 KB |
Output is correct |
29 |
Correct |
166 ms |
40872 KB |
Output is correct |
30 |
Correct |
238 ms |
50108 KB |
Output is correct |
31 |
Correct |
304 ms |
57856 KB |
Output is correct |
32 |
Correct |
11 ms |
15948 KB |
Output is correct |
33 |
Correct |
12 ms |
16076 KB |
Output is correct |
34 |
Correct |
10 ms |
15948 KB |
Output is correct |
35 |
Correct |
11 ms |
15988 KB |
Output is correct |
36 |
Correct |
12 ms |
15948 KB |
Output is correct |
37 |
Correct |
11 ms |
15956 KB |
Output is correct |
38 |
Correct |
11 ms |
15948 KB |
Output is correct |
39 |
Correct |
11 ms |
15948 KB |
Output is correct |
40 |
Correct |
11 ms |
15932 KB |
Output is correct |
41 |
Correct |
11 ms |
15880 KB |
Output is correct |
42 |
Correct |
11 ms |
15948 KB |
Output is correct |
43 |
Correct |
12 ms |
16204 KB |
Output is correct |
44 |
Correct |
13 ms |
16204 KB |
Output is correct |
45 |
Correct |
150 ms |
38096 KB |
Output is correct |
46 |
Correct |
222 ms |
49332 KB |
Output is correct |
47 |
Correct |
221 ms |
49108 KB |
Output is correct |
48 |
Correct |
11 ms |
15948 KB |
Output is correct |
49 |
Correct |
10 ms |
15948 KB |
Output is correct |
50 |
Correct |
13 ms |
15948 KB |
Output is correct |
51 |
Correct |
13 ms |
15996 KB |
Output is correct |
52 |
Correct |
11 ms |
15948 KB |
Output is correct |
53 |
Correct |
11 ms |
15948 KB |
Output is correct |
54 |
Correct |
12 ms |
15948 KB |
Output is correct |
55 |
Correct |
288 ms |
55656 KB |
Output is correct |
56 |
Correct |
10 ms |
15948 KB |
Output is correct |
57 |
Correct |
14 ms |
16332 KB |
Output is correct |
58 |
Correct |
17 ms |
17272 KB |
Output is correct |
59 |
Correct |
17 ms |
16972 KB |
Output is correct |
60 |
Correct |
149 ms |
36832 KB |
Output is correct |
61 |
Correct |
190 ms |
44972 KB |
Output is correct |
62 |
Correct |
237 ms |
49216 KB |
Output is correct |
63 |
Correct |
295 ms |
56912 KB |
Output is correct |
64 |
Correct |
13 ms |
15948 KB |
Output is correct |
65 |
Correct |
13 ms |
15948 KB |
Output is correct |
66 |
Correct |
10 ms |
15948 KB |
Output is correct |
67 |
Correct |
265 ms |
55220 KB |
Output is correct |
68 |
Correct |
287 ms |
55296 KB |
Output is correct |
69 |
Correct |
274 ms |
56328 KB |
Output is correct |
70 |
Correct |
16 ms |
16332 KB |
Output is correct |
71 |
Correct |
14 ms |
16788 KB |
Output is correct |
72 |
Correct |
158 ms |
37584 KB |
Output is correct |
73 |
Correct |
264 ms |
49800 KB |
Output is correct |
74 |
Correct |
310 ms |
59684 KB |
Output is correct |
75 |
Correct |
328 ms |
66864 KB |
Output is correct |
76 |
Correct |
322 ms |
57984 KB |
Output is correct |
77 |
Correct |
16 ms |
16460 KB |
Output is correct |
78 |
Correct |
16 ms |
16912 KB |
Output is correct |
79 |
Correct |
151 ms |
38708 KB |
Output is correct |
80 |
Correct |
278 ms |
50720 KB |
Output is correct |
81 |
Correct |
359 ms |
62112 KB |
Output is correct |
82 |
Correct |
11 ms |
15948 KB |
Output is correct |
83 |
Correct |
10 ms |
15948 KB |
Output is correct |
84 |
Correct |
11 ms |
15948 KB |
Output is correct |
85 |
Correct |
386 ms |
68204 KB |
Output is correct |
86 |
Correct |
359 ms |
66180 KB |
Output is correct |
87 |
Correct |
356 ms |
64896 KB |
Output is correct |
88 |
Correct |
278 ms |
59680 KB |
Output is correct |
89 |
Correct |
133 ms |
27072 KB |
Output is correct |
90 |
Correct |
130 ms |
33356 KB |
Output is correct |
91 |
Correct |
129 ms |
34156 KB |
Output is correct |
92 |
Correct |
267 ms |
49412 KB |
Output is correct |
93 |
Correct |
269 ms |
49412 KB |
Output is correct |
94 |
Correct |
318 ms |
66536 KB |
Output is correct |
95 |
Correct |
350 ms |
66516 KB |
Output is correct |
96 |
Correct |
12 ms |
15948 KB |
Output is correct |
97 |
Correct |
29 ms |
19344 KB |
Output is correct |
98 |
Correct |
68 ms |
21580 KB |
Output is correct |
99 |
Correct |
348 ms |
68260 KB |
Output is correct |
100 |
Correct |
18 ms |
16844 KB |
Output is correct |
101 |
Correct |
43 ms |
20552 KB |
Output is correct |
102 |
Correct |
80 ms |
25068 KB |
Output is correct |
103 |
Correct |
133 ms |
33400 KB |
Output is correct |
104 |
Correct |
179 ms |
39280 KB |
Output is correct |
105 |
Correct |
288 ms |
47148 KB |
Output is correct |
106 |
Correct |
294 ms |
53040 KB |
Output is correct |
107 |
Correct |
363 ms |
59020 KB |
Output is correct |
108 |
Correct |
10 ms |
15948 KB |
Output is correct |
109 |
Correct |
14 ms |
15944 KB |
Output is correct |
110 |
Correct |
11 ms |
15948 KB |
Output is correct |
111 |
Correct |
12 ms |
15948 KB |
Output is correct |
112 |
Correct |
13 ms |
15988 KB |
Output is correct |
113 |
Correct |
12 ms |
15972 KB |
Output is correct |
114 |
Correct |
12 ms |
15948 KB |
Output is correct |
115 |
Correct |
11 ms |
15948 KB |
Output is correct |
116 |
Correct |
11 ms |
15948 KB |
Output is correct |
117 |
Correct |
11 ms |
16040 KB |
Output is correct |
118 |
Correct |
13 ms |
15948 KB |
Output is correct |
119 |
Correct |
12 ms |
16160 KB |
Output is correct |
120 |
Correct |
15 ms |
16332 KB |
Output is correct |
121 |
Correct |
147 ms |
38200 KB |
Output is correct |
122 |
Correct |
221 ms |
49340 KB |
Output is correct |
123 |
Correct |
261 ms |
49060 KB |
Output is correct |
124 |
Correct |
11 ms |
15948 KB |
Output is correct |
125 |
Correct |
11 ms |
15948 KB |
Output is correct |
126 |
Correct |
12 ms |
15976 KB |
Output is correct |
127 |
Correct |
274 ms |
55216 KB |
Output is correct |
128 |
Correct |
331 ms |
55328 KB |
Output is correct |
129 |
Correct |
281 ms |
56328 KB |
Output is correct |
130 |
Correct |
14 ms |
16356 KB |
Output is correct |
131 |
Correct |
15 ms |
16672 KB |
Output is correct |
132 |
Correct |
145 ms |
37700 KB |
Output is correct |
133 |
Correct |
248 ms |
50004 KB |
Output is correct |
134 |
Correct |
366 ms |
59792 KB |
Output is correct |
135 |
Correct |
347 ms |
67688 KB |
Output is correct |
136 |
Correct |
345 ms |
66900 KB |
Output is correct |
137 |
Correct |
348 ms |
68096 KB |
Output is correct |
138 |
Correct |
361 ms |
68176 KB |
Output is correct |
139 |
Correct |
302 ms |
58432 KB |
Output is correct |
140 |
Correct |
12 ms |
15896 KB |
Output is correct |
141 |
Correct |
56 ms |
23736 KB |
Output is correct |
142 |
Correct |
26 ms |
17988 KB |
Output is correct |
143 |
Correct |
61 ms |
22572 KB |
Output is correct |
144 |
Correct |
100 ms |
27104 KB |
Output is correct |
145 |
Correct |
182 ms |
41244 KB |
Output is correct |
146 |
Correct |
232 ms |
49276 KB |
Output is correct |
147 |
Correct |
361 ms |
55236 KB |
Output is correct |
148 |
Correct |
369 ms |
60768 KB |
Output is correct |
149 |
Correct |
421 ms |
67132 KB |
Output is correct |
150 |
Correct |
360 ms |
66792 KB |
Output is correct |
151 |
Correct |
295 ms |
57936 KB |
Output is correct |
152 |
Correct |
14 ms |
16460 KB |
Output is correct |
153 |
Correct |
20 ms |
16868 KB |
Output is correct |
154 |
Correct |
185 ms |
38732 KB |
Output is correct |
155 |
Correct |
237 ms |
50696 KB |
Output is correct |
156 |
Correct |
324 ms |
62116 KB |
Output is correct |
157 |
Correct |
11 ms |
15904 KB |
Output is correct |
158 |
Correct |
10 ms |
15948 KB |
Output is correct |
159 |
Correct |
12 ms |
15944 KB |
Output is correct |
160 |
Correct |
11 ms |
15948 KB |
Output is correct |
161 |
Correct |
372 ms |
58732 KB |
Output is correct |
162 |
Correct |
369 ms |
68224 KB |
Output is correct |
163 |
Correct |
378 ms |
60164 KB |
Output is correct |
164 |
Correct |
321 ms |
59928 KB |
Output is correct |
165 |
Correct |
411 ms |
60160 KB |
Output is correct |
166 |
Correct |
313 ms |
59404 KB |
Output is correct |
167 |
Correct |
68 ms |
25024 KB |
Output is correct |
168 |
Correct |
32 ms |
18996 KB |
Output is correct |
169 |
Correct |
67 ms |
23592 KB |
Output is correct |
170 |
Correct |
118 ms |
29860 KB |
Output is correct |
171 |
Correct |
183 ms |
34260 KB |
Output is correct |
172 |
Correct |
144 ms |
35380 KB |
Output is correct |
173 |
Correct |
171 ms |
38776 KB |
Output is correct |
174 |
Correct |
203 ms |
42928 KB |
Output is correct |
175 |
Correct |
244 ms |
46904 KB |
Output is correct |
176 |
Correct |
280 ms |
51408 KB |
Output is correct |
177 |
Correct |
290 ms |
54788 KB |
Output is correct |