#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
int construct_roads(vector<int> x, vector<int> y) {
int n = (int) x.size();
vector<pair<int, int>> ys;
for (int i = 0; i < n; ++i) {
ys.emplace_back(y[i], i);
}
sort(ys.begin(), ys.end());
vector<int> u(n - 1), v(n - 1), a(n - 1), b(n - 1);
for (int i = 0; i < n - 1; ++i) {
if (ys[i + 1].first - ys[i].first != 2) {
return 0;
}
u[i] = ys[i].second;
v[i] = ys[i + 1].second;
a[i] = 1;
b[i] = ys[i].first + 1;
}
build(u, v, a, b);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
37 ms |
8532 KB |
Output is correct |
10 |
Correct |
4 ms |
1292 KB |
Output is correct |
11 |
Correct |
18 ms |
4752 KB |
Output is correct |
12 |
Correct |
5 ms |
1760 KB |
Output is correct |
13 |
Correct |
6 ms |
2516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
39 ms |
8584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
37 ms |
8532 KB |
Output is correct |
10 |
Correct |
4 ms |
1292 KB |
Output is correct |
11 |
Correct |
18 ms |
4752 KB |
Output is correct |
12 |
Correct |
5 ms |
1760 KB |
Output is correct |
13 |
Correct |
6 ms |
2516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
39 ms |
8584 KB |
Output is correct |
17 |
Incorrect |
1 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
37 ms |
8532 KB |
Output is correct |
10 |
Correct |
4 ms |
1292 KB |
Output is correct |
11 |
Correct |
18 ms |
4752 KB |
Output is correct |
12 |
Correct |
5 ms |
1760 KB |
Output is correct |
13 |
Correct |
6 ms |
2516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
39 ms |
8584 KB |
Output is correct |
17 |
Incorrect |
1 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
37 ms |
8532 KB |
Output is correct |
10 |
Correct |
4 ms |
1292 KB |
Output is correct |
11 |
Correct |
18 ms |
4752 KB |
Output is correct |
12 |
Correct |
5 ms |
1760 KB |
Output is correct |
13 |
Correct |
6 ms |
2516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
39 ms |
8584 KB |
Output is correct |
17 |
Incorrect |
1 ms |
344 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
37 ms |
8532 KB |
Output is correct |
10 |
Correct |
4 ms |
1292 KB |
Output is correct |
11 |
Correct |
18 ms |
4752 KB |
Output is correct |
12 |
Correct |
5 ms |
1760 KB |
Output is correct |
13 |
Correct |
6 ms |
2516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
39 ms |
8584 KB |
Output is correct |
17 |
Incorrect |
44 ms |
10176 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
37 ms |
8532 KB |
Output is correct |
10 |
Correct |
4 ms |
1292 KB |
Output is correct |
11 |
Correct |
18 ms |
4752 KB |
Output is correct |
12 |
Correct |
5 ms |
1760 KB |
Output is correct |
13 |
Correct |
6 ms |
2516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
39 ms |
8584 KB |
Output is correct |
17 |
Incorrect |
1 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |