Submission #401014

# Submission time Handle Problem Language Result Execution time Memory
401014 2021-05-09T06:51:58 Z KoD Fibonacci representations (CEOI18_fib) C++17
0 / 100
1 ms 288 KB
#include <bits/stdc++.h>

template <class T>
using Vec = std::vector<T>;

using ll = long long;

int main() {
    int N;
    std::cin >> N;
    Vec<int> A;
    for (int steps = 0; steps < N; ++steps) {
        { 
            int x;
            std::cin >> x;
            A.push_back(x);  
        }
        std::sort(A.begin(), A.end());
        std::array<ll, 2> dp{};
        dp[0] = 1;
        int last = 0;
        for (const auto x: A) {
            const auto dif = x - last;
            std::array<ll, 2> next{};
            for (int i = 0; i < 2; ++i) {
                next[0] += dp[i];
                next[1] += dp[i] * ((dif - 1 + i) / 2);
            }
            dp = std::move(next);
            last = x;
        }
        std::cout << dp[0] + dp[1] << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -