This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | 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... |