답안 #584994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
584994 2022-06-28T08:20:50 Z Jomnoi Fibonacci representations (CEOI18_fib) C++17
5 / 100
10 ms 2864 KB
#include <bits/stdc++.h>
using namespace std;

const int MAX_W = 150005;
const int MAX_N = 1e5 + 5;
const int MOD = 1e9 + 7;

int A[MAX_N];
long long f[MAX_N];
long long dp[MAX_W];

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    
    int N;
    cin >> N;

    f[1] = 1;
    f[2] = 2;
    for(int i = 3; i <= 50; i++) {
        f[i] = f[i - 1] + f[i - 2];
    }

    dp[0] = 1;
    for(int i = 1; i <= 50; i++) {
        for(int j = MAX_W; j >= f[i]; j--) {
            dp[j] += dp[j - f[i]];
            dp[j] %= MOD;
        }
    }

    int prefix = 0;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];

        prefix += f[A[i]];
        cout << dp[prefix] << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1492 KB Output is correct
2 Correct 10 ms 1508 KB Output is correct
3 Correct 7 ms 1508 KB Output is correct
4 Correct 8 ms 1492 KB Output is correct
5 Correct 7 ms 1480 KB Output is correct
6 Correct 6 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1492 KB Output is correct
2 Correct 10 ms 1508 KB Output is correct
3 Correct 7 ms 1508 KB Output is correct
4 Correct 8 ms 1492 KB Output is correct
5 Correct 7 ms 1480 KB Output is correct
6 Correct 6 ms 1492 KB Output is correct
7 Correct 6 ms 1492 KB Output is correct
8 Runtime error 8 ms 2760 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 2772 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1492 KB Output is correct
2 Correct 10 ms 1508 KB Output is correct
3 Correct 7 ms 1508 KB Output is correct
4 Correct 8 ms 1492 KB Output is correct
5 Correct 7 ms 1480 KB Output is correct
6 Correct 6 ms 1492 KB Output is correct
7 Correct 6 ms 1492 KB Output is correct
8 Runtime error 8 ms 2760 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 2864 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1492 KB Output is correct
2 Correct 10 ms 1508 KB Output is correct
3 Correct 7 ms 1508 KB Output is correct
4 Correct 8 ms 1492 KB Output is correct
5 Correct 7 ms 1480 KB Output is correct
6 Correct 6 ms 1492 KB Output is correct
7 Correct 6 ms 1492 KB Output is correct
8 Runtime error 8 ms 2760 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -