#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] = 2;
b[i] = ys[i].first + 1;
}
build(u, v, a, b);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
a[0] = 2 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
a[0] = 2 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
a[0] = 2 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
a[0] = 2 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
a[0] = 2 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
a[0] = 2 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |