Submission #334807

#TimeUsernameProblemLanguageResultExecution timeMemory
334807limabeansRack (eJOI19_rack)C++17
40 / 100
1 ms364 KiB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;




ll f(ll n, ll k) {
    if (n==0) return 1;
    if (n<=62 && k>(1ll<<n)/2) {
	return 2ll*f(n-1,k-(1ll<<n)/2);
    } else {
	return 2ll*f(n-1,k)-1;
    }
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    ll n,k;
    cin>>n>>k;

    cout<<f(n,k)<<endl;
    
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...