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;
const int maxn = 2e5 + 100;
int ord[maxn];
int construct_roads(std::vector<int> x, std::vector<int> y){
int n = x.size();
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
vector<pair<int, int>>c;
for(int i=0; i<n; i++){
c.push_back({y[i], i});
}
sort(c.begin(), c.end());
bool ok = 1;
vector<int>u, v, a, b;
for(int i=1; i<n; i++){
if(c[i].first-c[i-1].first != 2) ok = 0;
u.push_back(c[i-1].second);
v.push_back(c[i].second);
a.push_back(1);
b.push_back(c[i].first-1);
}
if(ok) build(u, v, a, b);
return ok;
}
# | 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... |