# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097485 | 2024-10-07T13:03:49 Z | vjudge1 | Rack (eJOI19_rack) | C++17 | 1 ms | 600 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long int; const int MOD = 1e9 + 7; int log2_floor(unsigned long long x) { return x ? __builtin_clzll(1) - __builtin_clzll(x) : -1; } int pow(int b, int p) { if (!p) return 1; int p2 = pow(b, p >> 1); return (1LL * p2 * p2 * (p & 1 ? b : 1)) % MOD; } int test(int n, ll k) { k--; ll result = 1; while (k) { ll mask = k & (-k); result = (result + pow(2, n - log2_floor(mask) - 1)) % MOD; k ^= mask; } return result % MOD; } int main() { int n, k; scanf("%d %d", &n, &k); printf("%d\n", test(n, k)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 600 KB | Output is correct |
9 | Correct | 0 ms | 440 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 600 KB | Output is correct |
9 | Correct | 0 ms | 440 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Incorrect | 0 ms | 348 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |