This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//by szh
#include<bits/stdc++.h>
using namespace std;
#define fi first.first
#define se first.second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
#include "parks.h"
int id[5][200010];
int construct_roads(std::vector<int> x, std::vector<int> y) {
memset(id,-1,sizeof(id));
rep(i,0,SZ(x)) {
id[x[i]][y[i]]= i;
}
vector <int> u,v,a,b;
rep(i,0,200010) {
if (id[2][i]!=-1) {
if (i>=2 and id[2][i-2]!=-1) u.pb(id[2][i]),v.pb(id[2][i-2]),a.pb(1),b.pb(i-1);
}
if (id[4][i]!=-1) {
if (i>=2 and id[4][i-2]!=-1) u.pb(id[4][i]),v.pb(id[4][i-2]),a.pb(5),b.pb(i-1);
if (id[2][i]!=-1 and (i<2 or id[2][i-2]==-1 or id[4][i-2]==-1)) u.pb(id[4][i]),v.pb(id[2][i]),a.pb(3),b.pb(i-1);
}
}
if (SZ(u)!=SZ(x)-1) return 0;
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... |