Submission #942854

# Submission time Handle Problem Language Result Execution time Memory
942854 2024-03-11T05:24:46 Z vjudge1 Fibonacci representations (CEOI18_fib) C++17
5 / 100
888 ms 45308 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int mod=1e9+7;
int f[30];
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);

    int n;
    cin>>n;
    vector <int> a(n);
    f[1]=1;f[2]=2;
    for(int i=3;i<=20;i++)f[i]=f[i-1]+f[i-2];
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]=f[a[i]];
        if(i-1>=0)a[i]+=a[i-1];
    }
    for(int i=0;i<n;i++){
        vector <int> dp(a[i]+1);
        dp[0]=1;
        for(int j=1;j<=20;j++){
            for(int k=a[i];k>=f[j];k--){
                dp[k]+=dp[k-f[j]];
                dp[k]%=mod;
            }
        }
        cout<<dp[a[i]]<<"\n";
    }
}
/*
 
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 89 ms 952 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 888 ms 45308 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 89 ms 952 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 89 ms 952 KB Output isn't correct
9 Halted 0 ms 0 KB -