This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |