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;
#define ll int
#define F first
#define S second
#define pb push_back
#define sz(x) (ll)x.size()
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
void printVct(vi &v){
for (ll i =0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
int construct_roads(vi x, vi y) {
ll n = sz(x);
vii yy(n);
for (ll i=0; i<n; i++){
yy[i] = ii(y[i], i);
}
sort(yy.begin(), yy.end());
vi mp(n);
for (ll i =0; i<n; i++){
mp[i] = yy[i].S;
}
sort(y.begin(), y.end());
vi u,v,a,b;
for (ll i= 0; i<n-1; i++){
if (y[i] != y[i+1] - 2){
return 0;
}
u.pb(mp[i]);
v.pb(mp[i+1]);
a.pb(1);
b.pb(y[i]+1);
}
build(u, v, a, b);
return 1;
}
/*
2
2 2
2 4
*/
# | 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... |