Submission #256008

#TimeUsernameProblemLanguageResultExecution timeMemory
256008jdhRack (eJOI19_rack)C++17
100 / 100
9 ms7936 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9+7; int main(){ ios::sync_with_stdio(0); cin.tie(0); ll n,k; cin >> n >> k; vector<ll> pow2(n); pow2[0] = 1; for(int i = 1; i < n; ++i) pow2[i] = (2*pow2[i-1])%mod; ll ans = 1; int idx = n-1; while(true){ if(k%2 == 0) ans = (ans+pow2[idx])%mod; if(k == 1) break; k = (k+1)/2; --idx; } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...