Submission #675709

#TimeUsernameProblemLanguageResultExecution timeMemory
675709AlmaRack (eJOI19_rack)C++17
0 / 100
1 ms244 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(NULL); ll mod = 1e9+7; ll n, k; cin >> n >> k; ll pos = 1, add = n; bool inv = false; for (int i = 0; i < min(n, 1LL * 60); i++) { add--; if (inv == false) { if ((k & (1 << i))) { inv = 1; } else { pos |= (1 << add); pos %= mod; } } else { if ((k & (1 << i))) { pos |= (1 << add); pos %= mod; } else { inv = true; } } } cout << pos << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...