Submission #844695

# Submission time Handle Problem Language Result Execution time Memory
844695 2023-09-05T17:12:20 Z konber Rack (eJOI19_rack) C++14
40 / 100
1 ms 356 KB
#include <iostream>
#include <cmath>

using namespace std;
typedef long long ll;

int main()
{
    int n; ll k;
    scanf("%d%lld", &n, &k);
    ll first=1, last, mid;
    if(n > 60) last = pow(10, 18);
    else last = pow(2, n);
    k--;
    while(first != last){
        mid = (first+last)/2;
        if(k%2==0){
            last = mid;
            k /= 2;
        }
        else{
            first = mid+1;
            k /= 2;
        }
    }

    int mod=1e9+7;
    printf("%d\n", first%mod);
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:28:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'll' {aka 'long long int'} [-Wformat=]
   28 |     printf("%d\n", first%mod);
      |             ~^     ~~~~~~~~~
      |              |          |
      |              int        ll {aka long long int}
      |             %lld
rack.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d%lld", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 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 356 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 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 356 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 344 KB Output isn't correct
13 Halted 0 ms 0 KB -