# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
435306 | NintsiChkhaidze | Rack (eJOI19_rack) | C++14 | 100 ms | 15344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define left (node<<1),l,((l+r)>>1)
#define right ((node<<1)|1),((l+r)>>1) + 1,r
#define s second
#define f first
#define int ll
using namespace std;
vector <int> v;
map <int,int> f;
main (){
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
int n,k;
cin>>n>>k;
int a = (1<<(n - 1));
v.pb(1);
if (k == 1){
cout<<1;
return 0;
}
f[1] = 1;
while(a){
int id = 0;
while(id < v.size() && v[id] + a <= (1<<n) && !f[v[id] + a]){
f[v[id] + a] = 1;
v.pb(v[id] + a);
if (v.size() == k) {
cout<<v[id] + a;
return 0;
}
id++;
}
a/=2;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |