#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int construct_roads(vector<int> X, vector<int> Y) {
int N = X.size();
vector<int> ord(N);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int i, int j) {
return Y[i] < Y[j];
});
vector<int> u, v, a, b;
for (int i = 0; i < N - 1; i++) {
if (Y[ord[i]] + 2 != Y[ord[i + 1]]) {
return 0;
}
u.push_back(ord[i]);
v.push_back(ord[i + 1]);
a.push_back(1);
b.push_back(Y[ord[i]] + 1);
}
build(u, v, a, b);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
47 ms |
7084 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
22 ms |
3920 KB |
Output is correct |
12 |
Correct |
8 ms |
1592 KB |
Output is correct |
13 |
Correct |
7 ms |
1812 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
47 ms |
7112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
47 ms |
7084 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
22 ms |
3920 KB |
Output is correct |
12 |
Correct |
8 ms |
1592 KB |
Output is correct |
13 |
Correct |
7 ms |
1812 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
47 ms |
7112 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
47 ms |
7084 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
22 ms |
3920 KB |
Output is correct |
12 |
Correct |
8 ms |
1592 KB |
Output is correct |
13 |
Correct |
7 ms |
1812 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
47 ms |
7112 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
47 ms |
7084 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
22 ms |
3920 KB |
Output is correct |
12 |
Correct |
8 ms |
1592 KB |
Output is correct |
13 |
Correct |
7 ms |
1812 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
47 ms |
7112 KB |
Output is correct |
17 |
Incorrect |
0 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
47 ms |
7084 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
22 ms |
3920 KB |
Output is correct |
12 |
Correct |
8 ms |
1592 KB |
Output is correct |
13 |
Correct |
7 ms |
1812 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
47 ms |
7112 KB |
Output is correct |
17 |
Incorrect |
39 ms |
4212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
47 ms |
7084 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
22 ms |
3920 KB |
Output is correct |
12 |
Correct |
8 ms |
1592 KB |
Output is correct |
13 |
Correct |
7 ms |
1812 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
47 ms |
7112 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |