Submission #1149241

#TimeUsernameProblemLanguageResultExecution timeMemory
1149241pashtetkasRack (eJOI19_rack)C++17
100 / 100
8 ms328 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)wynik = ((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...