Submission #1077786

# Submission time Handle Problem Language Result Execution time Memory
1077786 2024-08-27T09:08:55 Z raduv Rack (eJOI19_rack) C++17
100 / 100
5 ms 436 KB
#include <bits/stdc++.h>
const int MOD = 1'000'000'007;

int main()
{
    int n, i;
    long long k, ans;
    scanf("%d%lld", &n, &k);
    ans = 0;
    k--;
    for( i = 0; i < n; i++ ){
      ans = (ans * 2 + k % 2) % MOD;
      k /= 2;
    }
    printf("%d\n", (ans + 1) % MOD);
    return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:15:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   15 |     printf("%d\n", (ans + 1) % MOD);
      |             ~^     ~~~~~~~~~~~~~~~
      |              |               |
      |              int             long long int
      |             %lld
rack.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%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 1 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 1 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 1 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 436 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 5 ms 348 KB Output is correct