Submission #246139

#TimeUsernameProblemLanguageResultExecution timeMemory
246139promaRack (eJOI19_rack)C++17
100 / 100
6 ms384 KiB
#include <bits/stdc++.h> #define endl "\n" #define int long long #define see(x) cerr<<#x<<"="<<x<<endl; using namespace std; const int N = 1e6 + 10; const int MOD = 1e9 + 7; int bp (int n) { if (!n) return 1; if (n & 1) return 2ll * bp(n-1) % MOD; int b = bp(n>>1); return b * b % MOD; } int n, k, ans = 1; int32_t main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; k --; for (int i = n - 1; i >= 0; -- i) if (k & 1) { ans += bp(i); ans %= MOD; k >>= 1; } else k >>= 1; cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...