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 <iostream>
#include <queue>
using namespace std;
using ll = long long;
const ll maxN = 1e6, P = 1e9 + 7;
vector<ll> powers(maxN + 1);
ll N, K, ans;
void precomp(){
powers[0] = 1;
for(ll i = 1; i <= maxN; ++i)
powers[i] = (powers[i - 1] * 2) % P;
return;
}
int main(){
precomp();
cin >> N >> K;
ans = 0;
while(N != 0){
if(K % 2 == 0) (ans += powers[N - 1]) %= P;
--N;
(K += 1) /= 2;
}
if(K == 1) (ans += 1) %= P;
cout << ans << '\n';
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... |