#include <bits/stdc++.h>
#include "parks.h"
using namespace std;
template <typename T>
using v = vector<T>;
using pii = pair<int, int>;
#define rep(i, k, n) for (int i = k; i < n; i++)
int construct_roads(v<int> x, v<int> y) {
int n = x.size();
v<pii> ys(n);
rep(i, 0, n) ys[i] = {y[i], i};
sort(ys.begin(), ys.end());
v<int> a(n-1), b(n-1);
v<int> fa(n-1), fb(n-1);
bool can = true;
rep(i, 0, n-1) {
a[i] = ys[i].second;
b[i] = ys[i+1].second;
if (ys[i+1].first-ys[i].first != 2) can = false;
fa[i] = 1;
fb[i] = ys[i].first+1;
}
if (can == false) return 0;
build(a, b, fa, fb);
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |