Submission #1149239

#TimeUsernameProblemLanguageResultExecution timeMemory
1149239pashtetkasRack (eJOI19_rack)C++17
0 / 100
0 ms320 KiB
// Header Files and namespaces
#include <bits/stdc++.h>

using namespace std;

// Code shorteners
typedef long long ll;
#define print(x) cout << x << '\n' 
#define endl '\n'                  
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int MOD = 1e9+7;
// Code
int main() {  
    fast;     
    int n; 
    ll k;
    cin >> n >> k;
    --k;


    int wynik = 1;
    for(int i = 1; i<=n; i++){
        if(k%2==0)((ll)2*wynik)%MOD;
        else wynik = ((ll)2*wynik+1)%MOD;

        k/=2;
    }

    int pow2 = 1;
    for(int i = 1; i<=n; i++)pow2 = ((ll)2*pow2)%MOD;

    

    cout << (wynik - (pow2 -1) + MOD) % MOD << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...