Submission #1123206

#TimeUsernameProblemLanguageResultExecution timeMemory
1123206mnbvcxz123Mechanical Doll (IOI18_doll)C++20
0 / 100
38 ms4416 KiB
#include<bits/stdc++.h> #include"doll.h" using namespace std; using ll=long long; #define all(v) v.begin(),v.end() #define sz(v) (int)v.size() constexpr int INF=1e9; vector<int>x,y,state,hm; int p=1,p2=0; void give_ind(int k, int l, int r){ int mid=(l+r)>>1; if(r-l==1){ if(mid+1>sz(hm))x[k]=-1; return; } if(mid+1>sz(hm))x[k]=-1; else{ x[k]=++p; x[k]=-x[k]; x.push_back(-INF); y.push_back(-INF); state.push_back(0); give_ind(-x[k],mid+1,r); } y[k]=++p; y[k]=-y[k]; x.push_back(-INF); y.push_back(-INF); state.push_back(0); give_ind(-y[k],l,mid); } void make_leaf(int k){ if(!state[k]){ state[k]^=1; if(x[k]==-INF)x[k]=hm[p2++]; else make_leaf(-x[k]); }else{ state[k]^=1; if(y[k]==-INF)y[k]=hm[p2++]; else make_leaf(-y[k]); } } void create_circuit(int m, vector<int>a){ int n=a.size(); vector<int>c(m+1,-1); x.push_back(-INF); y.push_back(-INF); state.push_back(0); a.push_back(0); x.push_back(-INF); y.push_back(-INF); state.push_back(0); hm=a; int p=1; while(p<n)p<<=1; give_ind(1,1,p); for(int i=0;i<sz(hm);++i) 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...