Submission #774503

#TimeUsernameProblemLanguageResultExecution timeMemory
774503serifefedartarRack (eJOI19_rack)C++17
100 / 100
7 ms8152 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); typedef long long ll; #define mod 1000000007 #define MAXN 1000005 ll n, k; ll pow2[MAXN]; int main() { fast pow2[0] = 1; for (ll i = 1; i < MAXN; i++) pow2[i] = (pow2[i-1] * 2) % mod; cin >> n >> k; ll ans = 1; for (ll i = 2; i < LLONG_MAX; i*=2) { if (k % i == 0 || k % i > i/2) ans = (ans + pow2[n-__builtin_ctzll(i)]) % mod; if (i > k) break; } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...