# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
634276 | antimirage | Rack (eJOI19_rack) | C++14 | 10 ms | 8120 KiB |
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;
const int N = 1e6 + 5;
long long n, k, ans, mod = 1e9 + 7, two[N];
main(){
cin >> n >> k;
two[0] = 1;
for (int i = 1; i < N; i++) {
two[i] = two[i - 1] * 2 % mod;
}
long long pw = n;
for (long long j = 0; j <= n; j++) {
assert(j <= 60);
if (k <= (1LL << j)) {
if (j > 0)
ans = (ans + two[pw]) % mod;
else {
cout << (ans + 1) % mod << endl;
return 0;
}
k -= (1LL << (j - 1));
pw = n;
j = -1;
} else {
pw--;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |