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>
#define int long long
using namespace std;
const int mod = 1e9+7;
int32_t main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,k;
cin >> n >> k;
vector<int> pow2(n);
pow2[0] = 1;
for (int i=1; i<n; ++i){
pow2[i] = (pow2[i-1]*2)%mod;
}
int ans = 0;
for (int i=n-1; i>=0; --i){
if (k%2 == 0) ans = (ans+pow2[i])%mod;
k = (k+1)>>1;
}
cout << ans+1;
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... |