# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
844641 | EntityPlantt | Rack (eJOI19_rack) | C++14 | 2 ms | 348 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 <cstdio>
#define int long long
const int mod = 1000000007;
int n, k, i, r = 1;
int pow2(int x) {
if (!x) return 1;
if (x & 1) return 2 * pow2(x / 2) % mod * pow2(x / 2) % mod;
return pow2(x / 2) * pow2(x / 2) % mod;
}
signed main() {
scanf("%lld%lld", &n, &k);
for (i = n - 1; i >= 0; i--) {
if (k & 1) k++;
else r = (r + pow2(i)) % mod;
k = (k + 1) / 2;
}
printf("%lld", r);
return 0;
}
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... |