# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631184 | 2022-08-17T18:49:59 Z | smartmonky | XORanges (eJOI19_xoranges) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; main(){ int n,k; cin >>n >>k; int x=(1 << n); vector <int> v(x*2); v[1]=1; ans.pb(1); v[2]=x/2+1; ans.pb(v[2]); int cnt=2; for(int i=x/4;i>=1;i/=2){ for(int j=1;j<=cnt;j++){ v[cnt+j]=v[j]+i; ans.pb(v[j]+i); } cnt*=2; } //for(int i=1;i<=x;i++) // cout<<v[i] <<" "; cout<<ans[k-1]; }