Submission #778394

#TimeUsernameProblemLanguageResultExecution timeMemory
778394andrei_iorgulescuRack (eJOI19_rack)C++14
100 / 100
8 ms7848 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int modulo = 1e9 + 7; int p2[1000005]; int f(int n,int k) { if (n == 0) return 1; if (k % 2 == 1) return f(n - 1,k / 2 + 1); else return (f(n - 1,k / 2) + p2[n - 1]) % modulo; } signed main() { int n,k; cin >> n >> k; p2[0] = 1; for (int i = 1; i <= n; i++) p2[i] = 2 * p2[i - 1] % modulo; cout << f(n,k); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...