Submission #615987

#TimeUsernameProblemLanguageResultExecution timeMemory
615987kidesoRack (eJOI19_rack)C++17
100 / 100
10 ms8148 KiB
#include <iostream> #include <queue> using namespace std; using ll = long long; const ll maxN = 1e6, P = 1e9 + 7; vector<ll> powers(maxN + 1); ll N, K, ans; void precomp(){ powers[0] = 1; for(ll i = 1; i <= maxN; ++i) powers[i] = (powers[i - 1] * 2) % P; return; } int main(){ precomp(); cin >> N >> K; ans = 0; while(N != 0){ if(K % 2 == 0) (ans += powers[N - 1]) %= P; --N; (K += 1) /= 2; } if(K == 1) (ans += 1) %= P; cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...