Submission #256364

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