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 <vector>
using namespace std;
void build(std::vector<int> u, std::vector<int> v, std::vector<int> a, std::vector<int> b);
int construct_roads(std::vector<int> x, std::vector<int> y)
{
bool pos=1;
int n=x.size();
vector<int> u,v,a,b;
vector<vector<int>> cp;
for(int i=0;i<n;i++)
cp.push_back({y[i],x[i],i});
for(int i=0;(i+1)<n;i++)
{
// go from y[i] to y[i+1]
if(cp[i+1][0]-cp[i][0] != 2)
return 0;
u.push_back(cp[i][2]);
v.push_back(cp[i+1][2]);
a.push_back(cp[i][1]-1);
b.push_back(cp[i][0]-1);
}
build(u,v,a,b);
return 1;
}
Compilation message (stderr)
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:6:7: warning: unused variable 'pos' [-Wunused-variable]
6 | bool pos=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... |