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 <bits/stdc++.h>
using namespace std;
#include "parks.h"
#define pb push_back
#define fi first
#define se second
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
std::vector<int> u, v, a, b;
int n=y.size();
vector<pair<int,int>> tab(n);
for (int i = 0; i < n; ++i) tab[i]={y[i],i};
sort(tab.begin(),tab.end());
bool test=true;
for (int i = 1; i < n; ++i)
{
if(tab[i].fi-tab[i-1].fi>2) test=false;
}
if(!test) return 0;
for (int i = 0; i < n-1; ++i)
{
a.pb(3);
b.pb(tab[i].fi+1);
u.pb(tab[i+1].se);
v.pb(tab[i].se);
}
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... |