Submission #1123202

#TimeUsernameProblemLanguageResultExecution timeMemory
1123202mnbvcxz123Mechanical Doll (IOI18_doll)C++20
Compilation error
0 ms0 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[rt],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(itn 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); }

Compilation message (stderr)

doll.cpp: In function 'void give_ind(int, int, int)':
doll.cpp:28:29: error: 'rt' was not declared in this scope; did you mean 'r'?
   28 |                 give_ind(-x[rt],mid+1,r);
      |                             ^~
      |                             r
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:66:13: error: 'itn' was not declared in this scope; did you mean 'int'?
   66 |         for(itn i=0;i<n;++i)
      |             ^~~
      |             int
doll.cpp:66:21: error: 'i' was not declared in this scope
   66 |         for(itn i=0;i<n;++i)
      |                     ^