Submission #453232

#TimeUsernameProblemLanguageResultExecution timeMemory
453232lukadupliRack (eJOI19_rack)C++14
100 / 100
5 ms204 KiB
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 5, MOD = 1e9 + 7; int n, sol; long long k; bool binary[MAX]; int main() { cin >> n >> k; k--; for(int i = 0; i < min(n, 64); i++){ if(k & (1LL << i)) binary[n - i - 1] = 1; } int pow2 = 1; for(int i = 0; i < n; i++){ if(binary[i]) sol = (sol + pow2) % MOD; pow2 = (pow2 * 2) % MOD; } cout << (sol + 1) % MOD; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...