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;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
long long int n,k;
long long int g = 1;
long long int b = 1;
cin >> n >> k;
k-=1;
for (int i = 0; i < n; i++)
{
// cout << g << " " << k%2 << "\n";
b *= 2;
b %= 1000000007;
g = (g*2)+k%2;
g %= 1000000007;
k /= 2;
}
b -= 1;
b %= 1000000007;
// cout << b << "\n";
if (b > g)
{
b -= g;
g = 1000000007-b;
}
else
{
g -= b;
}
cout << g;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |