Submission #401006

# Submission time Handle Problem Language Result Execution time Memory
401006 2021-05-09T06:40:56 Z KoD Fibonacci representations (CEOI18_fib) C++17
5 / 100
188 ms 3944 KB
#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
1 Correct 176 ms 2048 KB Output is correct
2 Correct 188 ms 2028 KB Output is correct
3 Correct 180 ms 1988 KB Output is correct
4 Correct 177 ms 1992 KB Output is correct
5 Correct 178 ms 1984 KB Output is correct
6 Correct 177 ms 1988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 176 ms 2048 KB Output is correct
2 Correct 188 ms 2028 KB Output is correct
3 Correct 180 ms 1988 KB Output is correct
4 Correct 177 ms 1992 KB Output is correct
5 Correct 178 ms 1984 KB Output is correct
6 Correct 177 ms 1988 KB Output is correct
7 Correct 182 ms 2132 KB Output is correct
8 Incorrect 178 ms 2032 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 177 ms 1968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 176 ms 2048 KB Output is correct
2 Correct 188 ms 2028 KB Output is correct
3 Correct 180 ms 1988 KB Output is correct
4 Correct 177 ms 1992 KB Output is correct
5 Correct 178 ms 1984 KB Output is correct
6 Correct 177 ms 1988 KB Output is correct
7 Correct 182 ms 2132 KB Output is correct
8 Incorrect 178 ms 2032 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 184 ms 3944 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 176 ms 2048 KB Output is correct
2 Correct 188 ms 2028 KB Output is correct
3 Correct 180 ms 1988 KB Output is correct
4 Correct 177 ms 1992 KB Output is correct
5 Correct 178 ms 1984 KB Output is correct
6 Correct 177 ms 1988 KB Output is correct
7 Correct 182 ms 2132 KB Output is correct
8 Incorrect 178 ms 2032 KB Output isn't correct
9 Halted 0 ms 0 KB -