Submission #844641

# Submission time Handle Problem Language Result Execution time Memory
844641 2023-09-05T15:17:16 Z EntityPlantt Rack (eJOI19_rack) C++14
100 / 100
2 ms 348 KB
#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

rack.cpp: In function 'int main()':
rack.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld%lld", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 0 ms 348 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 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct