#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
int n = x.size();
std::vector<int> u, v, a, b;
vector<int> ix(n);
iota(ix.begin(), ix.end(), 0);
sort(ix.begin(), ix.end(), [&](int a, int b) {
return y[a] < y[b];
});
for (int i = 1; i <n; i++) {
u.push_back(ix[i-1]);
v.push_back(ix[i]);
a.push_back(1);
b.push_back(y[ix[i]]);
if (i && y[ix[i]] != y[ix[i-1]]+2)
return 0;
}
build(u, v, a, b);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
b[0] = 4 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
b[0] = 4 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
b[0] = 4 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
b[0] = 4 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
b[0] = 4 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
b[0] = 4 is not an odd integer |
3 |
Halted |
0 ms |
0 KB |
- |