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 <cstdio>
#include <algorithm>
int fount[200005];
int sy[200005];
bool compare(int a, int b){ return sy[a] < sy[b]; }
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
int n = x.size();
for(int i=0; i<n; i++){
fount[i] = i;
sy[i] = y[i];
}
std::sort(&fount[0],&fount[n],compare);
std::sort(&sy[0],&sy[n]);
std::vector<int> u, v, a, b;
for(int i=0; i<n-1; i++){
if(sy[i+1]-sy[i] != 2) return 0;
u.push_back(fount[i]);
v.push_back(fount[i+1]);
a.push_back(1);
b.push_back(sy[i]+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... |