#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]==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:18: 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:18: 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: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]
170 | for(int i=0;i<link.size();i++)
| ~^~~~~~~~~~~~
parks.cpp:175: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]
175 | for(int i=0;i<link.size();i++)
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14412 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15984 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
10 ms |
15948 KB |
Output is correct |
6 |
Correct |
12 ms |
15948 KB |
Output is correct |
7 |
Correct |
12 ms |
15972 KB |
Output is correct |
8 |
Correct |
13 ms |
15948 KB |
Output is correct |
9 |
Correct |
131 ms |
36436 KB |
Output is correct |
10 |
Correct |
19 ms |
18124 KB |
Output is correct |
11 |
Correct |
61 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19152 KB |
Output is correct |
13 |
Correct |
29 ms |
21436 KB |
Output is correct |
14 |
Correct |
10 ms |
16024 KB |
Output is correct |
15 |
Correct |
11 ms |
16196 KB |
Output is correct |
16 |
Correct |
120 ms |
34588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14412 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15984 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
10 ms |
15948 KB |
Output is correct |
6 |
Correct |
12 ms |
15948 KB |
Output is correct |
7 |
Correct |
12 ms |
15972 KB |
Output is correct |
8 |
Correct |
13 ms |
15948 KB |
Output is correct |
9 |
Correct |
131 ms |
36436 KB |
Output is correct |
10 |
Correct |
19 ms |
18124 KB |
Output is correct |
11 |
Correct |
61 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19152 KB |
Output is correct |
13 |
Correct |
29 ms |
21436 KB |
Output is correct |
14 |
Correct |
10 ms |
16024 KB |
Output is correct |
15 |
Correct |
11 ms |
16196 KB |
Output is correct |
16 |
Correct |
120 ms |
34588 KB |
Output is correct |
17 |
Correct |
10 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15892 KB |
Output is correct |
20 |
Correct |
12 ms |
15948 KB |
Output is correct |
21 |
Correct |
10 ms |
15888 KB |
Output is correct |
22 |
Correct |
11 ms |
15984 KB |
Output is correct |
23 |
Correct |
304 ms |
58012 KB |
Output is correct |
24 |
Correct |
10 ms |
15948 KB |
Output is correct |
25 |
Correct |
13 ms |
16204 KB |
Output is correct |
26 |
Correct |
12 ms |
16224 KB |
Output is correct |
27 |
Correct |
13 ms |
16332 KB |
Output is correct |
28 |
Correct |
103 ms |
32956 KB |
Output is correct |
29 |
Correct |
160 ms |
40820 KB |
Output is correct |
30 |
Correct |
240 ms |
50188 KB |
Output is correct |
31 |
Correct |
281 ms |
57892 KB |
Output is correct |
32 |
Correct |
10 ms |
15948 KB |
Output is correct |
33 |
Correct |
10 ms |
15892 KB |
Output is correct |
34 |
Correct |
10 ms |
15948 KB |
Output is correct |
35 |
Correct |
12 ms |
15952 KB |
Output is correct |
36 |
Correct |
10 ms |
15948 KB |
Output is correct |
37 |
Correct |
11 ms |
15904 KB |
Output is correct |
38 |
Correct |
11 ms |
15984 KB |
Output is correct |
39 |
Correct |
11 ms |
15924 KB |
Output is correct |
40 |
Correct |
12 ms |
15948 KB |
Output is correct |
41 |
Correct |
11 ms |
15948 KB |
Output is correct |
42 |
Correct |
10 ms |
15948 KB |
Output is correct |
43 |
Correct |
12 ms |
16172 KB |
Output is correct |
44 |
Correct |
12 ms |
16204 KB |
Output is correct |
45 |
Correct |
147 ms |
38168 KB |
Output is correct |
46 |
Correct |
229 ms |
49320 KB |
Output is correct |
47 |
Correct |
214 ms |
49168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14412 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15984 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
10 ms |
15948 KB |
Output is correct |
6 |
Correct |
12 ms |
15948 KB |
Output is correct |
7 |
Correct |
12 ms |
15972 KB |
Output is correct |
8 |
Correct |
13 ms |
15948 KB |
Output is correct |
9 |
Correct |
131 ms |
36436 KB |
Output is correct |
10 |
Correct |
19 ms |
18124 KB |
Output is correct |
11 |
Correct |
61 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19152 KB |
Output is correct |
13 |
Correct |
29 ms |
21436 KB |
Output is correct |
14 |
Correct |
10 ms |
16024 KB |
Output is correct |
15 |
Correct |
11 ms |
16196 KB |
Output is correct |
16 |
Correct |
120 ms |
34588 KB |
Output is correct |
17 |
Correct |
10 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15892 KB |
Output is correct |
20 |
Correct |
12 ms |
15948 KB |
Output is correct |
21 |
Correct |
10 ms |
15888 KB |
Output is correct |
22 |
Correct |
11 ms |
15984 KB |
Output is correct |
23 |
Correct |
304 ms |
58012 KB |
Output is correct |
24 |
Correct |
10 ms |
15948 KB |
Output is correct |
25 |
Correct |
13 ms |
16204 KB |
Output is correct |
26 |
Correct |
12 ms |
16224 KB |
Output is correct |
27 |
Correct |
13 ms |
16332 KB |
Output is correct |
28 |
Correct |
103 ms |
32956 KB |
Output is correct |
29 |
Correct |
160 ms |
40820 KB |
Output is correct |
30 |
Correct |
240 ms |
50188 KB |
Output is correct |
31 |
Correct |
281 ms |
57892 KB |
Output is correct |
32 |
Correct |
10 ms |
15948 KB |
Output is correct |
33 |
Correct |
10 ms |
15892 KB |
Output is correct |
34 |
Correct |
10 ms |
15948 KB |
Output is correct |
35 |
Correct |
12 ms |
15952 KB |
Output is correct |
36 |
Correct |
10 ms |
15948 KB |
Output is correct |
37 |
Correct |
11 ms |
15904 KB |
Output is correct |
38 |
Correct |
11 ms |
15984 KB |
Output is correct |
39 |
Correct |
11 ms |
15924 KB |
Output is correct |
40 |
Correct |
12 ms |
15948 KB |
Output is correct |
41 |
Correct |
11 ms |
15948 KB |
Output is correct |
42 |
Correct |
10 ms |
15948 KB |
Output is correct |
43 |
Correct |
12 ms |
16172 KB |
Output is correct |
44 |
Correct |
12 ms |
16204 KB |
Output is correct |
45 |
Correct |
147 ms |
38168 KB |
Output is correct |
46 |
Correct |
229 ms |
49320 KB |
Output is correct |
47 |
Correct |
214 ms |
49168 KB |
Output is correct |
48 |
Correct |
10 ms |
15948 KB |
Output is correct |
49 |
Correct |
10 ms |
15948 KB |
Output is correct |
50 |
Correct |
11 ms |
15948 KB |
Output is correct |
51 |
Correct |
12 ms |
16008 KB |
Output is correct |
52 |
Correct |
12 ms |
15948 KB |
Output is correct |
53 |
Correct |
12 ms |
15948 KB |
Output is correct |
54 |
Correct |
11 ms |
15948 KB |
Output is correct |
55 |
Correct |
276 ms |
55676 KB |
Output is correct |
56 |
Correct |
10 ms |
15948 KB |
Output is correct |
57 |
Correct |
13 ms |
16272 KB |
Output is correct |
58 |
Correct |
16 ms |
17356 KB |
Output is correct |
59 |
Correct |
17 ms |
16932 KB |
Output is correct |
60 |
Correct |
133 ms |
36748 KB |
Output is correct |
61 |
Correct |
210 ms |
45004 KB |
Output is correct |
62 |
Correct |
232 ms |
49300 KB |
Output is correct |
63 |
Correct |
299 ms |
57004 KB |
Output is correct |
64 |
Correct |
11 ms |
15948 KB |
Output is correct |
65 |
Correct |
11 ms |
15924 KB |
Output is correct |
66 |
Correct |
10 ms |
15948 KB |
Output is correct |
67 |
Correct |
282 ms |
55204 KB |
Output is correct |
68 |
Correct |
258 ms |
55424 KB |
Output is correct |
69 |
Correct |
259 ms |
56236 KB |
Output is correct |
70 |
Correct |
12 ms |
16332 KB |
Output is correct |
71 |
Correct |
15 ms |
16780 KB |
Output is correct |
72 |
Correct |
131 ms |
37692 KB |
Output is correct |
73 |
Correct |
223 ms |
49788 KB |
Output is correct |
74 |
Correct |
304 ms |
59904 KB |
Output is correct |
75 |
Correct |
344 ms |
66812 KB |
Output is correct |
76 |
Correct |
328 ms |
58044 KB |
Output is correct |
77 |
Correct |
13 ms |
16444 KB |
Output is correct |
78 |
Correct |
15 ms |
16844 KB |
Output is correct |
79 |
Correct |
138 ms |
38684 KB |
Output is correct |
80 |
Correct |
248 ms |
50696 KB |
Output is correct |
81 |
Correct |
341 ms |
62216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14412 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15984 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
10 ms |
15948 KB |
Output is correct |
6 |
Correct |
12 ms |
15948 KB |
Output is correct |
7 |
Correct |
12 ms |
15972 KB |
Output is correct |
8 |
Correct |
13 ms |
15948 KB |
Output is correct |
9 |
Correct |
131 ms |
36436 KB |
Output is correct |
10 |
Correct |
19 ms |
18124 KB |
Output is correct |
11 |
Correct |
61 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19152 KB |
Output is correct |
13 |
Correct |
29 ms |
21436 KB |
Output is correct |
14 |
Correct |
10 ms |
16024 KB |
Output is correct |
15 |
Correct |
11 ms |
16196 KB |
Output is correct |
16 |
Correct |
120 ms |
34588 KB |
Output is correct |
17 |
Correct |
12 ms |
15984 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
12 ms |
15948 KB |
Output is correct |
20 |
Correct |
313 ms |
68276 KB |
Output is correct |
21 |
Correct |
320 ms |
66004 KB |
Output is correct |
22 |
Correct |
325 ms |
64940 KB |
Output is correct |
23 |
Correct |
261 ms |
59628 KB |
Output is correct |
24 |
Correct |
107 ms |
27044 KB |
Output is correct |
25 |
Correct |
133 ms |
33352 KB |
Output is correct |
26 |
Correct |
136 ms |
34132 KB |
Output is correct |
27 |
Correct |
259 ms |
49408 KB |
Output is correct |
28 |
Correct |
255 ms |
49500 KB |
Output is correct |
29 |
Correct |
345 ms |
66432 KB |
Output is correct |
30 |
Correct |
304 ms |
66500 KB |
Output is correct |
31 |
Correct |
10 ms |
16000 KB |
Output is correct |
32 |
Correct |
28 ms |
19376 KB |
Output is correct |
33 |
Correct |
59 ms |
21568 KB |
Output is correct |
34 |
Correct |
330 ms |
68236 KB |
Output is correct |
35 |
Correct |
16 ms |
16872 KB |
Output is correct |
36 |
Correct |
43 ms |
20476 KB |
Output is correct |
37 |
Correct |
77 ms |
25064 KB |
Output is correct |
38 |
Correct |
121 ms |
33408 KB |
Output is correct |
39 |
Correct |
168 ms |
39324 KB |
Output is correct |
40 |
Correct |
211 ms |
47044 KB |
Output is correct |
41 |
Correct |
276 ms |
52972 KB |
Output is correct |
42 |
Correct |
313 ms |
58924 KB |
Output is correct |
43 |
Correct |
10 ms |
15948 KB |
Output is correct |
44 |
Correct |
11 ms |
15936 KB |
Output is correct |
45 |
Correct |
10 ms |
15948 KB |
Output is correct |
46 |
Correct |
10 ms |
15948 KB |
Output is correct |
47 |
Correct |
11 ms |
15948 KB |
Output is correct |
48 |
Correct |
11 ms |
15948 KB |
Output is correct |
49 |
Correct |
10 ms |
15988 KB |
Output is correct |
50 |
Correct |
11 ms |
15948 KB |
Output is correct |
51 |
Correct |
12 ms |
15948 KB |
Output is correct |
52 |
Correct |
10 ms |
15904 KB |
Output is correct |
53 |
Correct |
12 ms |
15948 KB |
Output is correct |
54 |
Correct |
11 ms |
16220 KB |
Output is correct |
55 |
Correct |
13 ms |
16332 KB |
Output is correct |
56 |
Correct |
141 ms |
38144 KB |
Output is correct |
57 |
Correct |
223 ms |
49320 KB |
Output is correct |
58 |
Correct |
203 ms |
49072 KB |
Output is correct |
59 |
Correct |
10 ms |
15948 KB |
Output is correct |
60 |
Correct |
10 ms |
15948 KB |
Output is correct |
61 |
Correct |
11 ms |
15948 KB |
Output is correct |
62 |
Correct |
267 ms |
55168 KB |
Output is correct |
63 |
Correct |
262 ms |
55384 KB |
Output is correct |
64 |
Correct |
273 ms |
56256 KB |
Output is correct |
65 |
Correct |
13 ms |
16332 KB |
Output is correct |
66 |
Correct |
15 ms |
16716 KB |
Output is correct |
67 |
Correct |
132 ms |
37692 KB |
Output is correct |
68 |
Correct |
230 ms |
49828 KB |
Output is correct |
69 |
Correct |
285 ms |
59776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14412 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15984 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
10 ms |
15948 KB |
Output is correct |
6 |
Correct |
12 ms |
15948 KB |
Output is correct |
7 |
Correct |
12 ms |
15972 KB |
Output is correct |
8 |
Correct |
13 ms |
15948 KB |
Output is correct |
9 |
Correct |
131 ms |
36436 KB |
Output is correct |
10 |
Correct |
19 ms |
18124 KB |
Output is correct |
11 |
Correct |
61 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19152 KB |
Output is correct |
13 |
Correct |
29 ms |
21436 KB |
Output is correct |
14 |
Correct |
10 ms |
16024 KB |
Output is correct |
15 |
Correct |
11 ms |
16196 KB |
Output is correct |
16 |
Correct |
120 ms |
34588 KB |
Output is correct |
17 |
Correct |
297 ms |
67752 KB |
Output is correct |
18 |
Correct |
307 ms |
66956 KB |
Output is correct |
19 |
Correct |
319 ms |
67920 KB |
Output is correct |
20 |
Correct |
342 ms |
68148 KB |
Output is correct |
21 |
Correct |
267 ms |
58420 KB |
Output is correct |
22 |
Correct |
10 ms |
15948 KB |
Output is correct |
23 |
Correct |
52 ms |
23788 KB |
Output is correct |
24 |
Correct |
27 ms |
18008 KB |
Output is correct |
25 |
Correct |
59 ms |
22548 KB |
Output is correct |
26 |
Correct |
92 ms |
27100 KB |
Output is correct |
27 |
Correct |
169 ms |
41276 KB |
Output is correct |
28 |
Correct |
233 ms |
49304 KB |
Output is correct |
29 |
Correct |
271 ms |
55176 KB |
Output is correct |
30 |
Correct |
314 ms |
60800 KB |
Output is correct |
31 |
Correct |
365 ms |
67164 KB |
Output is correct |
32 |
Correct |
373 ms |
66992 KB |
Output is correct |
33 |
Correct |
280 ms |
57992 KB |
Output is correct |
34 |
Correct |
13 ms |
16460 KB |
Output is correct |
35 |
Correct |
15 ms |
16892 KB |
Output is correct |
36 |
Correct |
137 ms |
38720 KB |
Output is correct |
37 |
Correct |
229 ms |
50832 KB |
Output is correct |
38 |
Correct |
318 ms |
62224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14412 KB |
Output is correct |
2 |
Correct |
10 ms |
15948 KB |
Output is correct |
3 |
Correct |
10 ms |
15984 KB |
Output is correct |
4 |
Correct |
10 ms |
15948 KB |
Output is correct |
5 |
Correct |
10 ms |
15948 KB |
Output is correct |
6 |
Correct |
12 ms |
15948 KB |
Output is correct |
7 |
Correct |
12 ms |
15972 KB |
Output is correct |
8 |
Correct |
13 ms |
15948 KB |
Output is correct |
9 |
Correct |
131 ms |
36436 KB |
Output is correct |
10 |
Correct |
19 ms |
18124 KB |
Output is correct |
11 |
Correct |
61 ms |
27148 KB |
Output is correct |
12 |
Correct |
27 ms |
19152 KB |
Output is correct |
13 |
Correct |
29 ms |
21436 KB |
Output is correct |
14 |
Correct |
10 ms |
16024 KB |
Output is correct |
15 |
Correct |
11 ms |
16196 KB |
Output is correct |
16 |
Correct |
120 ms |
34588 KB |
Output is correct |
17 |
Correct |
10 ms |
15948 KB |
Output is correct |
18 |
Correct |
10 ms |
15948 KB |
Output is correct |
19 |
Correct |
10 ms |
15892 KB |
Output is correct |
20 |
Correct |
12 ms |
15948 KB |
Output is correct |
21 |
Correct |
10 ms |
15888 KB |
Output is correct |
22 |
Correct |
11 ms |
15984 KB |
Output is correct |
23 |
Correct |
304 ms |
58012 KB |
Output is correct |
24 |
Correct |
10 ms |
15948 KB |
Output is correct |
25 |
Correct |
13 ms |
16204 KB |
Output is correct |
26 |
Correct |
12 ms |
16224 KB |
Output is correct |
27 |
Correct |
13 ms |
16332 KB |
Output is correct |
28 |
Correct |
103 ms |
32956 KB |
Output is correct |
29 |
Correct |
160 ms |
40820 KB |
Output is correct |
30 |
Correct |
240 ms |
50188 KB |
Output is correct |
31 |
Correct |
281 ms |
57892 KB |
Output is correct |
32 |
Correct |
10 ms |
15948 KB |
Output is correct |
33 |
Correct |
10 ms |
15892 KB |
Output is correct |
34 |
Correct |
10 ms |
15948 KB |
Output is correct |
35 |
Correct |
12 ms |
15952 KB |
Output is correct |
36 |
Correct |
10 ms |
15948 KB |
Output is correct |
37 |
Correct |
11 ms |
15904 KB |
Output is correct |
38 |
Correct |
11 ms |
15984 KB |
Output is correct |
39 |
Correct |
11 ms |
15924 KB |
Output is correct |
40 |
Correct |
12 ms |
15948 KB |
Output is correct |
41 |
Correct |
11 ms |
15948 KB |
Output is correct |
42 |
Correct |
10 ms |
15948 KB |
Output is correct |
43 |
Correct |
12 ms |
16172 KB |
Output is correct |
44 |
Correct |
12 ms |
16204 KB |
Output is correct |
45 |
Correct |
147 ms |
38168 KB |
Output is correct |
46 |
Correct |
229 ms |
49320 KB |
Output is correct |
47 |
Correct |
214 ms |
49168 KB |
Output is correct |
48 |
Correct |
10 ms |
15948 KB |
Output is correct |
49 |
Correct |
10 ms |
15948 KB |
Output is correct |
50 |
Correct |
11 ms |
15948 KB |
Output is correct |
51 |
Correct |
12 ms |
16008 KB |
Output is correct |
52 |
Correct |
12 ms |
15948 KB |
Output is correct |
53 |
Correct |
12 ms |
15948 KB |
Output is correct |
54 |
Correct |
11 ms |
15948 KB |
Output is correct |
55 |
Correct |
276 ms |
55676 KB |
Output is correct |
56 |
Correct |
10 ms |
15948 KB |
Output is correct |
57 |
Correct |
13 ms |
16272 KB |
Output is correct |
58 |
Correct |
16 ms |
17356 KB |
Output is correct |
59 |
Correct |
17 ms |
16932 KB |
Output is correct |
60 |
Correct |
133 ms |
36748 KB |
Output is correct |
61 |
Correct |
210 ms |
45004 KB |
Output is correct |
62 |
Correct |
232 ms |
49300 KB |
Output is correct |
63 |
Correct |
299 ms |
57004 KB |
Output is correct |
64 |
Correct |
11 ms |
15948 KB |
Output is correct |
65 |
Correct |
11 ms |
15924 KB |
Output is correct |
66 |
Correct |
10 ms |
15948 KB |
Output is correct |
67 |
Correct |
282 ms |
55204 KB |
Output is correct |
68 |
Correct |
258 ms |
55424 KB |
Output is correct |
69 |
Correct |
259 ms |
56236 KB |
Output is correct |
70 |
Correct |
12 ms |
16332 KB |
Output is correct |
71 |
Correct |
15 ms |
16780 KB |
Output is correct |
72 |
Correct |
131 ms |
37692 KB |
Output is correct |
73 |
Correct |
223 ms |
49788 KB |
Output is correct |
74 |
Correct |
304 ms |
59904 KB |
Output is correct |
75 |
Correct |
344 ms |
66812 KB |
Output is correct |
76 |
Correct |
328 ms |
58044 KB |
Output is correct |
77 |
Correct |
13 ms |
16444 KB |
Output is correct |
78 |
Correct |
15 ms |
16844 KB |
Output is correct |
79 |
Correct |
138 ms |
38684 KB |
Output is correct |
80 |
Correct |
248 ms |
50696 KB |
Output is correct |
81 |
Correct |
341 ms |
62216 KB |
Output is correct |
82 |
Correct |
12 ms |
15984 KB |
Output is correct |
83 |
Correct |
10 ms |
15948 KB |
Output is correct |
84 |
Correct |
12 ms |
15948 KB |
Output is correct |
85 |
Correct |
313 ms |
68276 KB |
Output is correct |
86 |
Correct |
320 ms |
66004 KB |
Output is correct |
87 |
Correct |
325 ms |
64940 KB |
Output is correct |
88 |
Correct |
261 ms |
59628 KB |
Output is correct |
89 |
Correct |
107 ms |
27044 KB |
Output is correct |
90 |
Correct |
133 ms |
33352 KB |
Output is correct |
91 |
Correct |
136 ms |
34132 KB |
Output is correct |
92 |
Correct |
259 ms |
49408 KB |
Output is correct |
93 |
Correct |
255 ms |
49500 KB |
Output is correct |
94 |
Correct |
345 ms |
66432 KB |
Output is correct |
95 |
Correct |
304 ms |
66500 KB |
Output is correct |
96 |
Correct |
10 ms |
16000 KB |
Output is correct |
97 |
Correct |
28 ms |
19376 KB |
Output is correct |
98 |
Correct |
59 ms |
21568 KB |
Output is correct |
99 |
Correct |
330 ms |
68236 KB |
Output is correct |
100 |
Correct |
16 ms |
16872 KB |
Output is correct |
101 |
Correct |
43 ms |
20476 KB |
Output is correct |
102 |
Correct |
77 ms |
25064 KB |
Output is correct |
103 |
Correct |
121 ms |
33408 KB |
Output is correct |
104 |
Correct |
168 ms |
39324 KB |
Output is correct |
105 |
Correct |
211 ms |
47044 KB |
Output is correct |
106 |
Correct |
276 ms |
52972 KB |
Output is correct |
107 |
Correct |
313 ms |
58924 KB |
Output is correct |
108 |
Correct |
10 ms |
15948 KB |
Output is correct |
109 |
Correct |
11 ms |
15936 KB |
Output is correct |
110 |
Correct |
10 ms |
15948 KB |
Output is correct |
111 |
Correct |
10 ms |
15948 KB |
Output is correct |
112 |
Correct |
11 ms |
15948 KB |
Output is correct |
113 |
Correct |
11 ms |
15948 KB |
Output is correct |
114 |
Correct |
10 ms |
15988 KB |
Output is correct |
115 |
Correct |
11 ms |
15948 KB |
Output is correct |
116 |
Correct |
12 ms |
15948 KB |
Output is correct |
117 |
Correct |
10 ms |
15904 KB |
Output is correct |
118 |
Correct |
12 ms |
15948 KB |
Output is correct |
119 |
Correct |
11 ms |
16220 KB |
Output is correct |
120 |
Correct |
13 ms |
16332 KB |
Output is correct |
121 |
Correct |
141 ms |
38144 KB |
Output is correct |
122 |
Correct |
223 ms |
49320 KB |
Output is correct |
123 |
Correct |
203 ms |
49072 KB |
Output is correct |
124 |
Correct |
10 ms |
15948 KB |
Output is correct |
125 |
Correct |
10 ms |
15948 KB |
Output is correct |
126 |
Correct |
11 ms |
15948 KB |
Output is correct |
127 |
Correct |
267 ms |
55168 KB |
Output is correct |
128 |
Correct |
262 ms |
55384 KB |
Output is correct |
129 |
Correct |
273 ms |
56256 KB |
Output is correct |
130 |
Correct |
13 ms |
16332 KB |
Output is correct |
131 |
Correct |
15 ms |
16716 KB |
Output is correct |
132 |
Correct |
132 ms |
37692 KB |
Output is correct |
133 |
Correct |
230 ms |
49828 KB |
Output is correct |
134 |
Correct |
285 ms |
59776 KB |
Output is correct |
135 |
Correct |
297 ms |
67752 KB |
Output is correct |
136 |
Correct |
307 ms |
66956 KB |
Output is correct |
137 |
Correct |
319 ms |
67920 KB |
Output is correct |
138 |
Correct |
342 ms |
68148 KB |
Output is correct |
139 |
Correct |
267 ms |
58420 KB |
Output is correct |
140 |
Correct |
10 ms |
15948 KB |
Output is correct |
141 |
Correct |
52 ms |
23788 KB |
Output is correct |
142 |
Correct |
27 ms |
18008 KB |
Output is correct |
143 |
Correct |
59 ms |
22548 KB |
Output is correct |
144 |
Correct |
92 ms |
27100 KB |
Output is correct |
145 |
Correct |
169 ms |
41276 KB |
Output is correct |
146 |
Correct |
233 ms |
49304 KB |
Output is correct |
147 |
Correct |
271 ms |
55176 KB |
Output is correct |
148 |
Correct |
314 ms |
60800 KB |
Output is correct |
149 |
Correct |
365 ms |
67164 KB |
Output is correct |
150 |
Correct |
373 ms |
66992 KB |
Output is correct |
151 |
Correct |
280 ms |
57992 KB |
Output is correct |
152 |
Correct |
13 ms |
16460 KB |
Output is correct |
153 |
Correct |
15 ms |
16892 KB |
Output is correct |
154 |
Correct |
137 ms |
38720 KB |
Output is correct |
155 |
Correct |
229 ms |
50832 KB |
Output is correct |
156 |
Correct |
318 ms |
62224 KB |
Output is correct |
157 |
Correct |
11 ms |
15976 KB |
Output is correct |
158 |
Correct |
10 ms |
15948 KB |
Output is correct |
159 |
Correct |
11 ms |
15948 KB |
Output is correct |
160 |
Correct |
11 ms |
15916 KB |
Output is correct |
161 |
Correct |
285 ms |
58760 KB |
Output is correct |
162 |
Correct |
320 ms |
68296 KB |
Output is correct |
163 |
Correct |
307 ms |
60248 KB |
Output is correct |
164 |
Correct |
295 ms |
60036 KB |
Output is correct |
165 |
Incorrect |
297 ms |
60212 KB |
Tree @(22337, 22349) appears more than once: for edges on positions 1328 and 2650 |
166 |
Halted |
0 ms |
0 KB |
- |