#include "bits/stdc++.h"
#include "doll.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
vector<int> x,y,state,hm;
int p=1,p2=0;
void give_index(int rt,int l,int r){
int mid = (l+r)/2;
if(mid+1>sz(hm)) x[rt]=-1;
else{
x[rt]=-(++p);
x.push_back(0);
y.push_back(0);
state.push_back(0);
if(l!=r) give_index(-x[rt],mid+1,r);
}
y[rt]=-(++p);
x.push_back(0);
y.push_back(0);
state.push_back(0);
if(l!=r) give_index(-y[rt],l,mid);
}
void make_leaf(int rt){
if(state[rt]==0){
state[rt]^=1;
if(x[rt]==0) x[rt]=hm[p2++];
else make_leaf(-x[rt]);
}
else{
state[rt]^=1;
if(y[rt]==0) y[rt]=hm[p2++];
else make_leaf(-y[rt]);
}
}
void create_circuit(int m, vector<int> a){
vector<int> c(m+1);
x.push_back(0);
y.push_back(0);
state.push_back(0);
a.push_back(0);
x.push_back(0);
y.push_back(0);
state.push_back(0);
hm=a;
for(int i=0;i<=m;i++) c[i]=-1;
int nd=1;
while(nd*2<sz(hm)) nd<<=1;
give_index(1,1,nd);
make_leaf(1);
reverse(all(x));
x.pop_back();
reverse(all(x));
reverse(all(y));
y.pop_back();
reverse(all(y));
answer(c, x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |