Submission #844702

#TimeUsernameProblemLanguageResultExecution timeMemory
844702konberRack (eJOI19_rack)C++14
40 / 100
1 ms600 KiB
#include <iostream>
#include <cmath>

using namespace std;
typedef long long ll;

int main()
{
    ll n; ll k;
    scanf("%lld%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;
        }
    }

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

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld%lld", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...