제출 #1123204

#제출 시각아이디문제언어결과실행 시간메모리
1123204mnbvcxz123자동 인형 (IOI18_doll)C++20
0 / 100
0 ms324 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<n;++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...