Submission #582561

# Submission time Handle Problem Language Result Execution time Memory
582561 2022-06-24T05:41:24 Z 반딧불(#8370) Fibonacci representations (CEOI18_fib) C++17
5 / 100
5 ms 6356 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

int n;
ll fib[22];
ll arr[22];
ll DP[15002][25];

int main(){
    fib[0] = fib[1] = 1;
    for(int i=2; i<=20; i++) fib[i] = fib[i-1] + fib[i-2];
    DP[0][0] = 1;
    for(int i=0; i<=15000; i++){
        for(int j=0; j<20; j++){
            if(!DP[i][j]) continue;
            for(int k=j+1; k<=20; k++){
                if(i+fib[k] > 15000) continue;
                DP[i+fib[k]][k] = (DP[i+fib[k]][k] + DP[i][j]) % MOD;
            }
        }
    }

    scanf("%d", &n);
    ll sum = 0;
    for(int i=1; i<=n; i++){
        int x;
        scanf("%d", &x);
        sum += fib[x];
        printf("%lld\n", accumulate(DP[sum], DP[sum]+21, 0LL) % MOD);
    }

}

Compilation message

fib.cpp: In function 'int main()':
fib.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
fib.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3156 KB Output is correct
2 Correct 3 ms 3156 KB Output is correct
3 Correct 3 ms 3156 KB Output is correct
4 Correct 4 ms 3236 KB Output is correct
5 Correct 3 ms 3156 KB Output is correct
6 Correct 3 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3156 KB Output is correct
2 Correct 3 ms 3156 KB Output is correct
3 Correct 3 ms 3156 KB Output is correct
4 Correct 4 ms 3236 KB Output is correct
5 Correct 3 ms 3156 KB Output is correct
6 Correct 3 ms 3156 KB Output is correct
7 Correct 3 ms 3156 KB Output is correct
8 Runtime error 5 ms 6320 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 6264 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3156 KB Output is correct
2 Correct 3 ms 3156 KB Output is correct
3 Correct 3 ms 3156 KB Output is correct
4 Correct 4 ms 3236 KB Output is correct
5 Correct 3 ms 3156 KB Output is correct
6 Correct 3 ms 3156 KB Output is correct
7 Correct 3 ms 3156 KB Output is correct
8 Runtime error 5 ms 6320 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 6356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3156 KB Output is correct
2 Correct 3 ms 3156 KB Output is correct
3 Correct 3 ms 3156 KB Output is correct
4 Correct 4 ms 3236 KB Output is correct
5 Correct 3 ms 3156 KB Output is correct
6 Correct 3 ms 3156 KB Output is correct
7 Correct 3 ms 3156 KB Output is correct
8 Runtime error 5 ms 6320 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -