Submission #1258414

#TimeUsernameProblemLanguageResultExecution timeMemory
1258414furinaRack (eJOI19_rack)C++20
40 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
using lol = int64_t;
const int MOD = 1e18 + 7;
lol N, K;
lol ans = 1;

lol Furina(lol A, lol B){
    lol res = 1;
    while(B != 0){
        if(B % 2 == 1){
            res = (res * A) % MOD;
        }
        B = B / 2;
        A = (A * A) % MOD;
    }
    return res;
}


int main(){
    cin >> N >> K;

    for(lol i = N - 1; i >= 0; i--){
        if(K % 2 == 0){
            ans = (ans + Furina(2ll, i) % MOD);
        }
        K = (K + 1) / 2;
    }
    cout << ans;
}

Compilation message (stderr)

rack.cpp:4:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    4 | const int MOD = 1e18 + 7;
      |                 ~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...