Submission #650268

#TimeUsernameProblemLanguageResultExecution timeMemory
650268KenparRack (eJOI19_rack)C++17
40 / 100
1 ms212 KiB
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long
#define endl '\n'
 
const ll MOD = 998244353;
const ll INF = 1e16;
const int INT_INF = 1e9;
const ll MAX = 1e5+1;

ll solve(ll cur, ll layer, ll ans){
	if(layer == -1){
		return ans;
	}

	if(cur % 2){
		return solve((cur + 1)/2, layer-1, ans);
	}

	return solve((cur + 1)/2, layer-1, ans+pow(2, layer));
}
void solve(){
	ll a,b;
	cin>>a>>b;

	cout<<solve(b, a-1, 1);
}
 
 
int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(NULL);
	int t = 1;
 
	//cin >> t;
 
	while(t--){
		solve();
		cout<<endl;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...