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(vector<int> x, vector<int> y)
{
if (x.size() == 1)
{
build({}, {}, {}, {});
return 1;
}
// x[i] = 2
const int N = x.size();
vector<pair<int, int>> h(N);
for (int i = 0; i < N; i++)
h[i] = {y[i], i};
sort(h.begin(), h.end());
vector<int> u(N-1), v(N-1), a(N-1), b(N-1);
for (int i = 0; i < N - 1; i++)
{
if (h[i].first + 2 != h[i+1].first) return 0;
u[i] = h[i].second; v[i] = h[i+1].second;
a[i] = x[0] - 1; b[i] = h[i].first + 1;
}
build(u, v, a, b);
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... |