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 int long long
int md = 1e9+7;
void solve(){
int n, k;cin>>n>>k;
vector<int> v(1e6+10);
v[0] = 1;
for(int i = 1;i<1e6+10;i++) v[i] = (v[i-1]*2)%md;
int ans = 0;
while(k>1){
if(k%2==0) ans+=v[n-1];
ans%=md;
k = (k+1)/2;
n--;
}
ans++;
ans%=md;
cout<<ans<<endl;
}
int32_t main(){
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
int t = 1;
//cin>>t;
while(t--){
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |