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 <vector>
#include <queue>
#include <set>
using namespace std;
const long long mod = 1e9 + 7;
long long revBits(long long x, int bitCnt)
{
long long res = 0;
for(int bit = 0;bit<bitCnt;bit++)
{
res += (((x>>bit)&1LL)<<(bitCnt-bit-1));
res %= mod;
}
return res;
}
int main()
{
long long n, k;
cin >> n >> k;
cout << (revBits(k-1, n) + 1)%mod << '\n';
}
/*
5 3
5 0 1 2 5
5 2 3
4 2 3
1 4 5
3 1
2 2 1
1 2 3
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |