#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
int ord[maxn];
int construct_roads(std::vector<int> x, std::vector<int> y){
int n = x.size();
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
vector<pair<int, int>>c;
for(int i=0; i<n; i++){
c.push_back({y[i], i});
}
sort(c.begin(), c.end());
bool ok = 1;
vector<int>u, v, a, b;
for(int i=1; i<n; i++){
if(c[i].first-c[i-1].first != 2) ok = 0;
u.push_back(c[i-1].second);
v.push_back(c[i].second);
a.push_back(1);
b.push_back(c[i].first-1);
}
if(ok) build(u, v, a, b);
return ok;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
57 ms |
8092 KB |
Output is correct |
10 |
Correct |
6 ms |
1284 KB |
Output is correct |
11 |
Correct |
29 ms |
4812 KB |
Output is correct |
12 |
Correct |
7 ms |
1636 KB |
Output is correct |
13 |
Correct |
10 ms |
2956 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
352 KB |
Output is correct |
16 |
Correct |
57 ms |
9012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
57 ms |
8092 KB |
Output is correct |
10 |
Correct |
6 ms |
1284 KB |
Output is correct |
11 |
Correct |
29 ms |
4812 KB |
Output is correct |
12 |
Correct |
7 ms |
1636 KB |
Output is correct |
13 |
Correct |
10 ms |
2956 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
352 KB |
Output is correct |
16 |
Correct |
57 ms |
9012 KB |
Output is correct |
17 |
Incorrect |
0 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
57 ms |
8092 KB |
Output is correct |
10 |
Correct |
6 ms |
1284 KB |
Output is correct |
11 |
Correct |
29 ms |
4812 KB |
Output is correct |
12 |
Correct |
7 ms |
1636 KB |
Output is correct |
13 |
Correct |
10 ms |
2956 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
352 KB |
Output is correct |
16 |
Correct |
57 ms |
9012 KB |
Output is correct |
17 |
Incorrect |
0 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
57 ms |
8092 KB |
Output is correct |
10 |
Correct |
6 ms |
1284 KB |
Output is correct |
11 |
Correct |
29 ms |
4812 KB |
Output is correct |
12 |
Correct |
7 ms |
1636 KB |
Output is correct |
13 |
Correct |
10 ms |
2956 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
352 KB |
Output is correct |
16 |
Correct |
57 ms |
9012 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
57 ms |
8092 KB |
Output is correct |
10 |
Correct |
6 ms |
1284 KB |
Output is correct |
11 |
Correct |
29 ms |
4812 KB |
Output is correct |
12 |
Correct |
7 ms |
1636 KB |
Output is correct |
13 |
Correct |
10 ms |
2956 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
352 KB |
Output is correct |
16 |
Correct |
57 ms |
9012 KB |
Output is correct |
17 |
Incorrect |
64 ms |
12452 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
57 ms |
8092 KB |
Output is correct |
10 |
Correct |
6 ms |
1284 KB |
Output is correct |
11 |
Correct |
29 ms |
4812 KB |
Output is correct |
12 |
Correct |
7 ms |
1636 KB |
Output is correct |
13 |
Correct |
10 ms |
2956 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
352 KB |
Output is correct |
16 |
Correct |
57 ms |
9012 KB |
Output is correct |
17 |
Incorrect |
0 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |