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"
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |