#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
int construct_roads(std::vector<int> x, std::vector<int> y) {
int n = x.size();
if (x == vector<int>(n, 2)) {
int mn = *min_element(y.begin(), y.end());
int mx = *max_element(y.begin(), y.end());
if (mx - mn != (n - 1) * 2) {
return 0;
}
vector<int> p(n);
iota(p.begin(), p.end(), 0);
sort(p.begin(), p.end(), [&](int i, int j) {
return y[i] < y[j];
});
vector<int> u(n - 1), v(n - 1), a(n - 1), b(n - 1);
for (int i = 0; i < n - 1; i++) {
u[i] = p[i];
v[i] = p[i + 1];
a[i] = 3;
b[i] = y[p[i]] + 1;
}
build(u, v, a, b);
return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
260 KB |
Output is correct |
9 |
Correct |
53 ms |
9000 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
24 ms |
4948 KB |
Output is correct |
12 |
Correct |
7 ms |
1592 KB |
Output is correct |
13 |
Correct |
6 ms |
1532 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
54 ms |
8928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
260 KB |
Output is correct |
9 |
Correct |
53 ms |
9000 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
24 ms |
4948 KB |
Output is correct |
12 |
Correct |
7 ms |
1592 KB |
Output is correct |
13 |
Correct |
6 ms |
1532 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
54 ms |
8928 KB |
Output is correct |
17 |
Incorrect |
1 ms |
300 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
260 KB |
Output is correct |
9 |
Correct |
53 ms |
9000 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
24 ms |
4948 KB |
Output is correct |
12 |
Correct |
7 ms |
1592 KB |
Output is correct |
13 |
Correct |
6 ms |
1532 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
54 ms |
8928 KB |
Output is correct |
17 |
Incorrect |
1 ms |
300 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
260 KB |
Output is correct |
9 |
Correct |
53 ms |
9000 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
24 ms |
4948 KB |
Output is correct |
12 |
Correct |
7 ms |
1592 KB |
Output is correct |
13 |
Correct |
6 ms |
1532 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
54 ms |
8928 KB |
Output is correct |
17 |
Incorrect |
1 ms |
300 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
260 KB |
Output is correct |
9 |
Correct |
53 ms |
9000 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
24 ms |
4948 KB |
Output is correct |
12 |
Correct |
7 ms |
1592 KB |
Output is correct |
13 |
Correct |
6 ms |
1532 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
54 ms |
8928 KB |
Output is correct |
17 |
Incorrect |
40 ms |
6204 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
260 KB |
Output is correct |
9 |
Correct |
53 ms |
9000 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
24 ms |
4948 KB |
Output is correct |
12 |
Correct |
7 ms |
1592 KB |
Output is correct |
13 |
Correct |
6 ms |
1532 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
54 ms |
8928 KB |
Output is correct |
17 |
Incorrect |
1 ms |
300 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |