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 endl '\n'
#define mod 1000000007
#define ll long long
#define inf INT_MAX
#define pb push_back
const int N=(1<<18);
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n,k; cin>>n>>k;
ll l=1,r=1;
for(int i=0;i<n;i++){
r*=2;
r%=mod;
}
k--;
while(l<r){
if(k%2==0){
r=(l+r)/2;
}
else{
l=(l+r)/2+1;
}
k/=2;
}
cout<<l%mod;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |