#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[x];
}
}
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]==1)
{
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: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<adj[v].size();i++)
| ~^~~~~~~~~~~~~~
parks.cpp: In function 'void dfs_check(int)':
parks.cpp:48:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
48 | for(int i=0;i<adj2[v].size();i++)
| ~^~~~~~~~~~~~~~~
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:168:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
168 | for(int i=0;i<link.size();i++)
| ~^~~~~~~~~~~~
parks.cpp:173:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
173 | for(int i=0;i<link.size();i++)
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
14364 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
11 ms |
15948 KB |
Output is correct |
6 |
Correct |
10 ms |
15940 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
11 ms |
15908 KB |
Output is correct |
9 |
Correct |
121 ms |
36496 KB |
Output is correct |
10 |
Correct |
20 ms |
18176 KB |
Output is correct |
11 |
Correct |
54 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19168 KB |
Output is correct |
13 |
Correct |
30 ms |
21368 KB |
Output is correct |
14 |
Correct |
11 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
125 ms |
34520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
14364 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
11 ms |
15948 KB |
Output is correct |
6 |
Correct |
10 ms |
15940 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
11 ms |
15908 KB |
Output is correct |
9 |
Correct |
121 ms |
36496 KB |
Output is correct |
10 |
Correct |
20 ms |
18176 KB |
Output is correct |
11 |
Correct |
54 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19168 KB |
Output is correct |
13 |
Correct |
30 ms |
21368 KB |
Output is correct |
14 |
Correct |
11 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
125 ms |
34520 KB |
Output is correct |
17 |
Correct |
11 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15948 KB |
Output is correct |
20 |
Correct |
12 ms |
15948 KB |
Output is correct |
21 |
Correct |
11 ms |
15948 KB |
Output is correct |
22 |
Correct |
11 ms |
15948 KB |
Output is correct |
23 |
Correct |
294 ms |
57904 KB |
Output is correct |
24 |
Correct |
10 ms |
15948 KB |
Output is correct |
25 |
Correct |
13 ms |
16204 KB |
Output is correct |
26 |
Correct |
14 ms |
16332 KB |
Output is correct |
27 |
Correct |
13 ms |
16376 KB |
Output is correct |
28 |
Correct |
107 ms |
32948 KB |
Output is correct |
29 |
Correct |
170 ms |
40808 KB |
Output is correct |
30 |
Correct |
220 ms |
50208 KB |
Output is correct |
31 |
Correct |
297 ms |
57984 KB |
Output is correct |
32 |
Correct |
10 ms |
15948 KB |
Output is correct |
33 |
Correct |
10 ms |
15948 KB |
Output is correct |
34 |
Correct |
11 ms |
15948 KB |
Output is correct |
35 |
Correct |
10 ms |
15948 KB |
Output is correct |
36 |
Correct |
10 ms |
15948 KB |
Output is correct |
37 |
Correct |
10 ms |
15936 KB |
Output is correct |
38 |
Correct |
11 ms |
15948 KB |
Output is correct |
39 |
Correct |
9 ms |
15948 KB |
Output is correct |
40 |
Correct |
12 ms |
16012 KB |
Output is correct |
41 |
Correct |
11 ms |
15948 KB |
Output is correct |
42 |
Correct |
11 ms |
15948 KB |
Output is correct |
43 |
Correct |
11 ms |
16144 KB |
Output is correct |
44 |
Correct |
12 ms |
16204 KB |
Output is correct |
45 |
Correct |
148 ms |
38328 KB |
Output is correct |
46 |
Correct |
261 ms |
49328 KB |
Output is correct |
47 |
Correct |
209 ms |
49076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
14364 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
11 ms |
15948 KB |
Output is correct |
6 |
Correct |
10 ms |
15940 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
11 ms |
15908 KB |
Output is correct |
9 |
Correct |
121 ms |
36496 KB |
Output is correct |
10 |
Correct |
20 ms |
18176 KB |
Output is correct |
11 |
Correct |
54 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19168 KB |
Output is correct |
13 |
Correct |
30 ms |
21368 KB |
Output is correct |
14 |
Correct |
11 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
125 ms |
34520 KB |
Output is correct |
17 |
Correct |
11 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15948 KB |
Output is correct |
20 |
Correct |
12 ms |
15948 KB |
Output is correct |
21 |
Correct |
11 ms |
15948 KB |
Output is correct |
22 |
Correct |
11 ms |
15948 KB |
Output is correct |
23 |
Correct |
294 ms |
57904 KB |
Output is correct |
24 |
Correct |
10 ms |
15948 KB |
Output is correct |
25 |
Correct |
13 ms |
16204 KB |
Output is correct |
26 |
Correct |
14 ms |
16332 KB |
Output is correct |
27 |
Correct |
13 ms |
16376 KB |
Output is correct |
28 |
Correct |
107 ms |
32948 KB |
Output is correct |
29 |
Correct |
170 ms |
40808 KB |
Output is correct |
30 |
Correct |
220 ms |
50208 KB |
Output is correct |
31 |
Correct |
297 ms |
57984 KB |
Output is correct |
32 |
Correct |
10 ms |
15948 KB |
Output is correct |
33 |
Correct |
10 ms |
15948 KB |
Output is correct |
34 |
Correct |
11 ms |
15948 KB |
Output is correct |
35 |
Correct |
10 ms |
15948 KB |
Output is correct |
36 |
Correct |
10 ms |
15948 KB |
Output is correct |
37 |
Correct |
10 ms |
15936 KB |
Output is correct |
38 |
Correct |
11 ms |
15948 KB |
Output is correct |
39 |
Correct |
9 ms |
15948 KB |
Output is correct |
40 |
Correct |
12 ms |
16012 KB |
Output is correct |
41 |
Correct |
11 ms |
15948 KB |
Output is correct |
42 |
Correct |
11 ms |
15948 KB |
Output is correct |
43 |
Correct |
11 ms |
16144 KB |
Output is correct |
44 |
Correct |
12 ms |
16204 KB |
Output is correct |
45 |
Correct |
148 ms |
38328 KB |
Output is correct |
46 |
Correct |
261 ms |
49328 KB |
Output is correct |
47 |
Correct |
209 ms |
49076 KB |
Output is correct |
48 |
Correct |
12 ms |
15948 KB |
Output is correct |
49 |
Correct |
9 ms |
15948 KB |
Output is correct |
50 |
Correct |
9 ms |
15948 KB |
Output is correct |
51 |
Correct |
12 ms |
15952 KB |
Output is correct |
52 |
Correct |
10 ms |
15948 KB |
Output is correct |
53 |
Correct |
11 ms |
15904 KB |
Output is correct |
54 |
Correct |
11 ms |
16008 KB |
Output is correct |
55 |
Correct |
305 ms |
55588 KB |
Output is correct |
56 |
Correct |
11 ms |
15948 KB |
Output is correct |
57 |
Correct |
14 ms |
16324 KB |
Output is correct |
58 |
Correct |
16 ms |
17260 KB |
Output is correct |
59 |
Correct |
18 ms |
17016 KB |
Output is correct |
60 |
Correct |
145 ms |
36712 KB |
Output is correct |
61 |
Correct |
187 ms |
44928 KB |
Output is correct |
62 |
Correct |
231 ms |
49328 KB |
Output is correct |
63 |
Correct |
303 ms |
56964 KB |
Output is correct |
64 |
Correct |
10 ms |
15948 KB |
Output is correct |
65 |
Correct |
10 ms |
15948 KB |
Output is correct |
66 |
Correct |
10 ms |
15948 KB |
Output is correct |
67 |
Correct |
260 ms |
55208 KB |
Output is correct |
68 |
Correct |
286 ms |
55424 KB |
Output is correct |
69 |
Correct |
270 ms |
56332 KB |
Output is correct |
70 |
Correct |
13 ms |
16332 KB |
Output is correct |
71 |
Correct |
15 ms |
16756 KB |
Output is correct |
72 |
Correct |
176 ms |
37692 KB |
Output is correct |
73 |
Correct |
227 ms |
49848 KB |
Output is correct |
74 |
Correct |
313 ms |
59704 KB |
Output is correct |
75 |
Correct |
331 ms |
66852 KB |
Output is correct |
76 |
Correct |
271 ms |
57996 KB |
Output is correct |
77 |
Correct |
13 ms |
16460 KB |
Output is correct |
78 |
Correct |
16 ms |
16844 KB |
Output is correct |
79 |
Correct |
143 ms |
38724 KB |
Output is correct |
80 |
Correct |
231 ms |
50700 KB |
Output is correct |
81 |
Correct |
331 ms |
62244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
14364 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
11 ms |
15948 KB |
Output is correct |
6 |
Correct |
10 ms |
15940 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
11 ms |
15908 KB |
Output is correct |
9 |
Correct |
121 ms |
36496 KB |
Output is correct |
10 |
Correct |
20 ms |
18176 KB |
Output is correct |
11 |
Correct |
54 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19168 KB |
Output is correct |
13 |
Correct |
30 ms |
21368 KB |
Output is correct |
14 |
Correct |
11 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
125 ms |
34520 KB |
Output is correct |
17 |
Correct |
10 ms |
15908 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15896 KB |
Output is correct |
20 |
Correct |
337 ms |
68184 KB |
Output is correct |
21 |
Correct |
319 ms |
66012 KB |
Output is correct |
22 |
Correct |
327 ms |
64964 KB |
Output is correct |
23 |
Correct |
256 ms |
59696 KB |
Output is correct |
24 |
Correct |
132 ms |
27044 KB |
Output is correct |
25 |
Correct |
132 ms |
33332 KB |
Output is correct |
26 |
Correct |
131 ms |
34120 KB |
Output is correct |
27 |
Correct |
258 ms |
49420 KB |
Output is correct |
28 |
Correct |
255 ms |
49428 KB |
Output is correct |
29 |
Correct |
326 ms |
66456 KB |
Output is correct |
30 |
Correct |
319 ms |
66484 KB |
Output is correct |
31 |
Correct |
10 ms |
15948 KB |
Output is correct |
32 |
Correct |
29 ms |
19372 KB |
Output is correct |
33 |
Correct |
58 ms |
21584 KB |
Output is correct |
34 |
Correct |
349 ms |
68152 KB |
Output is correct |
35 |
Correct |
20 ms |
16876 KB |
Output is correct |
36 |
Correct |
47 ms |
20508 KB |
Output is correct |
37 |
Correct |
82 ms |
25068 KB |
Output is correct |
38 |
Correct |
122 ms |
33456 KB |
Output is correct |
39 |
Correct |
165 ms |
39304 KB |
Output is correct |
40 |
Correct |
218 ms |
47012 KB |
Output is correct |
41 |
Correct |
271 ms |
52972 KB |
Output is correct |
42 |
Correct |
335 ms |
58920 KB |
Output is correct |
43 |
Correct |
11 ms |
15904 KB |
Output is correct |
44 |
Correct |
10 ms |
15948 KB |
Output is correct |
45 |
Correct |
10 ms |
15948 KB |
Output is correct |
46 |
Correct |
11 ms |
15948 KB |
Output is correct |
47 |
Correct |
12 ms |
15948 KB |
Output is correct |
48 |
Correct |
12 ms |
15948 KB |
Output is correct |
49 |
Correct |
11 ms |
15948 KB |
Output is correct |
50 |
Correct |
11 ms |
15948 KB |
Output is correct |
51 |
Correct |
10 ms |
15948 KB |
Output is correct |
52 |
Correct |
12 ms |
15928 KB |
Output is correct |
53 |
Correct |
10 ms |
15948 KB |
Output is correct |
54 |
Correct |
13 ms |
16204 KB |
Output is correct |
55 |
Correct |
12 ms |
16228 KB |
Output is correct |
56 |
Correct |
143 ms |
38136 KB |
Output is correct |
57 |
Correct |
236 ms |
49440 KB |
Output is correct |
58 |
Correct |
212 ms |
49056 KB |
Output is correct |
59 |
Correct |
10 ms |
15948 KB |
Output is correct |
60 |
Correct |
11 ms |
15948 KB |
Output is correct |
61 |
Correct |
10 ms |
15948 KB |
Output is correct |
62 |
Correct |
273 ms |
55212 KB |
Output is correct |
63 |
Correct |
289 ms |
55296 KB |
Output is correct |
64 |
Correct |
294 ms |
56332 KB |
Output is correct |
65 |
Correct |
13 ms |
16332 KB |
Output is correct |
66 |
Correct |
16 ms |
16696 KB |
Output is correct |
67 |
Correct |
136 ms |
37692 KB |
Output is correct |
68 |
Correct |
268 ms |
49820 KB |
Output is correct |
69 |
Correct |
307 ms |
59736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
14364 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
11 ms |
15948 KB |
Output is correct |
6 |
Correct |
10 ms |
15940 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
11 ms |
15908 KB |
Output is correct |
9 |
Correct |
121 ms |
36496 KB |
Output is correct |
10 |
Correct |
20 ms |
18176 KB |
Output is correct |
11 |
Correct |
54 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19168 KB |
Output is correct |
13 |
Correct |
30 ms |
21368 KB |
Output is correct |
14 |
Correct |
11 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
125 ms |
34520 KB |
Output is correct |
17 |
Correct |
356 ms |
67676 KB |
Output is correct |
18 |
Correct |
302 ms |
66900 KB |
Output is correct |
19 |
Correct |
334 ms |
67952 KB |
Output is correct |
20 |
Correct |
367 ms |
68140 KB |
Output is correct |
21 |
Correct |
281 ms |
58492 KB |
Output is correct |
22 |
Correct |
11 ms |
15948 KB |
Output is correct |
23 |
Correct |
54 ms |
23700 KB |
Output is correct |
24 |
Correct |
25 ms |
17988 KB |
Output is correct |
25 |
Correct |
59 ms |
22500 KB |
Output is correct |
26 |
Correct |
109 ms |
27120 KB |
Output is correct |
27 |
Correct |
208 ms |
41272 KB |
Output is correct |
28 |
Correct |
215 ms |
49228 KB |
Output is correct |
29 |
Correct |
265 ms |
55212 KB |
Output is correct |
30 |
Correct |
329 ms |
60820 KB |
Output is correct |
31 |
Correct |
373 ms |
67192 KB |
Output is correct |
32 |
Correct |
321 ms |
66860 KB |
Output is correct |
33 |
Correct |
269 ms |
57940 KB |
Output is correct |
34 |
Correct |
14 ms |
16460 KB |
Output is correct |
35 |
Correct |
16 ms |
16844 KB |
Output is correct |
36 |
Correct |
169 ms |
38712 KB |
Output is correct |
37 |
Correct |
235 ms |
50716 KB |
Output is correct |
38 |
Correct |
304 ms |
62164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
14364 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15948 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
11 ms |
15948 KB |
Output is correct |
6 |
Correct |
10 ms |
15940 KB |
Output is correct |
7 |
Correct |
11 ms |
15948 KB |
Output is correct |
8 |
Correct |
11 ms |
15908 KB |
Output is correct |
9 |
Correct |
121 ms |
36496 KB |
Output is correct |
10 |
Correct |
20 ms |
18176 KB |
Output is correct |
11 |
Correct |
54 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19168 KB |
Output is correct |
13 |
Correct |
30 ms |
21368 KB |
Output is correct |
14 |
Correct |
11 ms |
16076 KB |
Output is correct |
15 |
Correct |
13 ms |
16076 KB |
Output is correct |
16 |
Correct |
125 ms |
34520 KB |
Output is correct |
17 |
Correct |
11 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15948 KB |
Output is correct |
20 |
Correct |
12 ms |
15948 KB |
Output is correct |
21 |
Correct |
11 ms |
15948 KB |
Output is correct |
22 |
Correct |
11 ms |
15948 KB |
Output is correct |
23 |
Correct |
294 ms |
57904 KB |
Output is correct |
24 |
Correct |
10 ms |
15948 KB |
Output is correct |
25 |
Correct |
13 ms |
16204 KB |
Output is correct |
26 |
Correct |
14 ms |
16332 KB |
Output is correct |
27 |
Correct |
13 ms |
16376 KB |
Output is correct |
28 |
Correct |
107 ms |
32948 KB |
Output is correct |
29 |
Correct |
170 ms |
40808 KB |
Output is correct |
30 |
Correct |
220 ms |
50208 KB |
Output is correct |
31 |
Correct |
297 ms |
57984 KB |
Output is correct |
32 |
Correct |
10 ms |
15948 KB |
Output is correct |
33 |
Correct |
10 ms |
15948 KB |
Output is correct |
34 |
Correct |
11 ms |
15948 KB |
Output is correct |
35 |
Correct |
10 ms |
15948 KB |
Output is correct |
36 |
Correct |
10 ms |
15948 KB |
Output is correct |
37 |
Correct |
10 ms |
15936 KB |
Output is correct |
38 |
Correct |
11 ms |
15948 KB |
Output is correct |
39 |
Correct |
9 ms |
15948 KB |
Output is correct |
40 |
Correct |
12 ms |
16012 KB |
Output is correct |
41 |
Correct |
11 ms |
15948 KB |
Output is correct |
42 |
Correct |
11 ms |
15948 KB |
Output is correct |
43 |
Correct |
11 ms |
16144 KB |
Output is correct |
44 |
Correct |
12 ms |
16204 KB |
Output is correct |
45 |
Correct |
148 ms |
38328 KB |
Output is correct |
46 |
Correct |
261 ms |
49328 KB |
Output is correct |
47 |
Correct |
209 ms |
49076 KB |
Output is correct |
48 |
Correct |
12 ms |
15948 KB |
Output is correct |
49 |
Correct |
9 ms |
15948 KB |
Output is correct |
50 |
Correct |
9 ms |
15948 KB |
Output is correct |
51 |
Correct |
12 ms |
15952 KB |
Output is correct |
52 |
Correct |
10 ms |
15948 KB |
Output is correct |
53 |
Correct |
11 ms |
15904 KB |
Output is correct |
54 |
Correct |
11 ms |
16008 KB |
Output is correct |
55 |
Correct |
305 ms |
55588 KB |
Output is correct |
56 |
Correct |
11 ms |
15948 KB |
Output is correct |
57 |
Correct |
14 ms |
16324 KB |
Output is correct |
58 |
Correct |
16 ms |
17260 KB |
Output is correct |
59 |
Correct |
18 ms |
17016 KB |
Output is correct |
60 |
Correct |
145 ms |
36712 KB |
Output is correct |
61 |
Correct |
187 ms |
44928 KB |
Output is correct |
62 |
Correct |
231 ms |
49328 KB |
Output is correct |
63 |
Correct |
303 ms |
56964 KB |
Output is correct |
64 |
Correct |
10 ms |
15948 KB |
Output is correct |
65 |
Correct |
10 ms |
15948 KB |
Output is correct |
66 |
Correct |
10 ms |
15948 KB |
Output is correct |
67 |
Correct |
260 ms |
55208 KB |
Output is correct |
68 |
Correct |
286 ms |
55424 KB |
Output is correct |
69 |
Correct |
270 ms |
56332 KB |
Output is correct |
70 |
Correct |
13 ms |
16332 KB |
Output is correct |
71 |
Correct |
15 ms |
16756 KB |
Output is correct |
72 |
Correct |
176 ms |
37692 KB |
Output is correct |
73 |
Correct |
227 ms |
49848 KB |
Output is correct |
74 |
Correct |
313 ms |
59704 KB |
Output is correct |
75 |
Correct |
331 ms |
66852 KB |
Output is correct |
76 |
Correct |
271 ms |
57996 KB |
Output is correct |
77 |
Correct |
13 ms |
16460 KB |
Output is correct |
78 |
Correct |
16 ms |
16844 KB |
Output is correct |
79 |
Correct |
143 ms |
38724 KB |
Output is correct |
80 |
Correct |
231 ms |
50700 KB |
Output is correct |
81 |
Correct |
331 ms |
62244 KB |
Output is correct |
82 |
Correct |
10 ms |
15908 KB |
Output is correct |
83 |
Correct |
10 ms |
15948 KB |
Output is correct |
84 |
Correct |
10 ms |
15896 KB |
Output is correct |
85 |
Correct |
337 ms |
68184 KB |
Output is correct |
86 |
Correct |
319 ms |
66012 KB |
Output is correct |
87 |
Correct |
327 ms |
64964 KB |
Output is correct |
88 |
Correct |
256 ms |
59696 KB |
Output is correct |
89 |
Correct |
132 ms |
27044 KB |
Output is correct |
90 |
Correct |
132 ms |
33332 KB |
Output is correct |
91 |
Correct |
131 ms |
34120 KB |
Output is correct |
92 |
Correct |
258 ms |
49420 KB |
Output is correct |
93 |
Correct |
255 ms |
49428 KB |
Output is correct |
94 |
Correct |
326 ms |
66456 KB |
Output is correct |
95 |
Correct |
319 ms |
66484 KB |
Output is correct |
96 |
Correct |
10 ms |
15948 KB |
Output is correct |
97 |
Correct |
29 ms |
19372 KB |
Output is correct |
98 |
Correct |
58 ms |
21584 KB |
Output is correct |
99 |
Correct |
349 ms |
68152 KB |
Output is correct |
100 |
Correct |
20 ms |
16876 KB |
Output is correct |
101 |
Correct |
47 ms |
20508 KB |
Output is correct |
102 |
Correct |
82 ms |
25068 KB |
Output is correct |
103 |
Correct |
122 ms |
33456 KB |
Output is correct |
104 |
Correct |
165 ms |
39304 KB |
Output is correct |
105 |
Correct |
218 ms |
47012 KB |
Output is correct |
106 |
Correct |
271 ms |
52972 KB |
Output is correct |
107 |
Correct |
335 ms |
58920 KB |
Output is correct |
108 |
Correct |
11 ms |
15904 KB |
Output is correct |
109 |
Correct |
10 ms |
15948 KB |
Output is correct |
110 |
Correct |
10 ms |
15948 KB |
Output is correct |
111 |
Correct |
11 ms |
15948 KB |
Output is correct |
112 |
Correct |
12 ms |
15948 KB |
Output is correct |
113 |
Correct |
12 ms |
15948 KB |
Output is correct |
114 |
Correct |
11 ms |
15948 KB |
Output is correct |
115 |
Correct |
11 ms |
15948 KB |
Output is correct |
116 |
Correct |
10 ms |
15948 KB |
Output is correct |
117 |
Correct |
12 ms |
15928 KB |
Output is correct |
118 |
Correct |
10 ms |
15948 KB |
Output is correct |
119 |
Correct |
13 ms |
16204 KB |
Output is correct |
120 |
Correct |
12 ms |
16228 KB |
Output is correct |
121 |
Correct |
143 ms |
38136 KB |
Output is correct |
122 |
Correct |
236 ms |
49440 KB |
Output is correct |
123 |
Correct |
212 ms |
49056 KB |
Output is correct |
124 |
Correct |
10 ms |
15948 KB |
Output is correct |
125 |
Correct |
11 ms |
15948 KB |
Output is correct |
126 |
Correct |
10 ms |
15948 KB |
Output is correct |
127 |
Correct |
273 ms |
55212 KB |
Output is correct |
128 |
Correct |
289 ms |
55296 KB |
Output is correct |
129 |
Correct |
294 ms |
56332 KB |
Output is correct |
130 |
Correct |
13 ms |
16332 KB |
Output is correct |
131 |
Correct |
16 ms |
16696 KB |
Output is correct |
132 |
Correct |
136 ms |
37692 KB |
Output is correct |
133 |
Correct |
268 ms |
49820 KB |
Output is correct |
134 |
Correct |
307 ms |
59736 KB |
Output is correct |
135 |
Correct |
356 ms |
67676 KB |
Output is correct |
136 |
Correct |
302 ms |
66900 KB |
Output is correct |
137 |
Correct |
334 ms |
67952 KB |
Output is correct |
138 |
Correct |
367 ms |
68140 KB |
Output is correct |
139 |
Correct |
281 ms |
58492 KB |
Output is correct |
140 |
Correct |
11 ms |
15948 KB |
Output is correct |
141 |
Correct |
54 ms |
23700 KB |
Output is correct |
142 |
Correct |
25 ms |
17988 KB |
Output is correct |
143 |
Correct |
59 ms |
22500 KB |
Output is correct |
144 |
Correct |
109 ms |
27120 KB |
Output is correct |
145 |
Correct |
208 ms |
41272 KB |
Output is correct |
146 |
Correct |
215 ms |
49228 KB |
Output is correct |
147 |
Correct |
265 ms |
55212 KB |
Output is correct |
148 |
Correct |
329 ms |
60820 KB |
Output is correct |
149 |
Correct |
373 ms |
67192 KB |
Output is correct |
150 |
Correct |
321 ms |
66860 KB |
Output is correct |
151 |
Correct |
269 ms |
57940 KB |
Output is correct |
152 |
Correct |
14 ms |
16460 KB |
Output is correct |
153 |
Correct |
16 ms |
16844 KB |
Output is correct |
154 |
Correct |
169 ms |
38712 KB |
Output is correct |
155 |
Correct |
235 ms |
50716 KB |
Output is correct |
156 |
Correct |
304 ms |
62164 KB |
Output is correct |
157 |
Correct |
10 ms |
15948 KB |
Output is correct |
158 |
Correct |
10 ms |
15924 KB |
Output is correct |
159 |
Correct |
11 ms |
15928 KB |
Output is correct |
160 |
Correct |
12 ms |
15948 KB |
Output is correct |
161 |
Correct |
307 ms |
58764 KB |
Output is correct |
162 |
Correct |
340 ms |
68228 KB |
Output is correct |
163 |
Correct |
317 ms |
60288 KB |
Output is correct |
164 |
Correct |
314 ms |
59940 KB |
Output is correct |
165 |
Incorrect |
327 ms |
60216 KB |
Tree @(1885, 1897) appears more than once: for edges on positions 2989 and 4088 |
166 |
Halted |
0 ms |
0 KB |
- |