Submission #1096886

#TimeUsernameProblemLanguageResultExecution timeMemory
1096886sadsadsaRack (eJOI19_rack)C++14
100 / 100
4 ms456 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long int n,k; long long int g = 1; long long int b = 1; cin >> n >> k; k-=1; for (int i = 0; i < n; i++) { // cout << g << " " << k%2 << "\n"; b *= 2; b %= 1000000007; g = (g*2)+k%2; g %= 1000000007; k /= 2; } b -= 1; b %= 1000000007; // cout << b << "\n"; if (b > g) { b -= g; g = 1000000007-b; } else { g -= b; } cout << g; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...