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 "doll.h"
#include <bits/stdc++.h>
#define ll int
#define vll vector<ll>
#define pb push_back
#define sz size()
using namespace std;
vll x(400000,0),y(400000,0),c;
vector<vll> v;
ll n;
void build(ll v,ll tl,ll tr){
if(tl+1>=tr){
x[v-1]=y[v-1]=1;
if(tr>=n)y[v-1]=0;
if(tl>=n)y[v-1]=0;
//~ cout<<-v<<' '<<x[v-1]<<' '<<y[v-1]<<endl;
return;
}ll tm=(tl+tr)/2;
x[v-1]=-v*2;
y[v-1]=-v*2-1;
//~ cout<<-v<<' '<<x[v-1]<<' '<<y[v-1]<<endl;
build(v*2,tl,tm);
build(v*2+1,tm+1,tr);
}
void create_circuit(int m, std::vector<int> a) {
n = a.size();
ll i;
c.resize(m+1,0);
c[0]=a[0];
c[1]=-1;
build(1,1,n);
ll s=1;
vector<bool> f(400,0);
for(i=0;i<10;i++){
//~ cout<<s<<' ';
if(s==0)break;
if(s>0){
s=c[s];
}else {
if(f[-s]){
f[-s]=!f[-s];
s=y[-s-1];
}else {
f[-s]=!f[-s];
s=x[-s-1];
}
}
}
//~ cout<<endl;
answer(c, x, y);
}
# | 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... |