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