Submission #401006

#TimeUsernameProblemLanguageResultExecution timeMemory
401006KoDFibonacci representations (CEOI18_fib)C++17
5 / 100
188 ms3944 KiB
#include <bits/stdc++.h> template <class T> using Vec = std::vector<T>; using ll = long long; int main() { Vec<ll> fib(20); fib[0] = 1; fib[1] = 2; for (int i = 2; i < 20; ++i) { fib[i] = fib[i - 1] + fib[i - 2]; } std::map<ll, int> count; for (int set = 1; set < (1 << 20); ++ set) { ll sum = 0; for (int i = 0; i < 20; ++i) { if (set >> i & 1) { sum += fib[i]; } } count[sum] += 1; } int N; std::cin >> N; ll sum = 0; for (int i = 0; i < N; ++i) { int a; std::cin >> a; sum += fib[a - 1]; std::cout << count[sum] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...