Submission #624618

#TimeUsernameProblemLanguageResultExecution timeMemory
624618BlagojRack (eJOI19_rack)C++14
40 / 100
2 ms2492 KiB
#include <bits/stdc++.h> using namespace std; typedef unsigned long long int ull; typedef long long int ll; typedef long double ld; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); ull n, k, mod = 1000000007; cin >> n >> k; vector<ull> v = {1, (ull)((1 << (n - 1)) + 1) % mod}; ull sum = (1 << (n - 2)) % mod; if (k == 1) { cout << 1; return 0; } if (k == 2) { cout << v[1]; return 0; } while (sum > 0) { ull sz = v.size(); for (ull i = 0; i < sz; i++) { if ((i + 1) + sz == k) { cout << (ull)(v[i] + sum) % mod; return 0; } if (sum > 1) { v.push_back((v[i] + sum) % mod); } } sum /= 2; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...