Submission #844695

#TimeUsernameProblemLanguageResultExecution timeMemory
844695konberRack (eJOI19_rack)C++14
40 / 100
1 ms356 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...