Submission #942851

# Submission time Handle Problem Language Result Execution time Memory
942851 2024-03-11T05:22:17 Z vjudge1 Fibonacci representations (CEOI18_fib) C++17
0 / 100
494 ms 92852 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;
int f[20];
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<=15;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<=15;j++){
            for(int k=a[i];k>=f[j];k--){
                dp[k]+=dp[k-f[j]];
            }
        }
        cout<<dp[a[i]]<<"\n";
    }
}
/*
 
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 494 ms 92852 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 600 KB Output isn't correct
3 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 0 ms 344 KB Output is correct
2 Incorrect 1 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -