Submission #112393

# Submission time Handle Problem Language Result Execution time Memory
112393 2019-05-19T12:27:22 Z reda Fibonacci representations (CEOI18_fib) C++14
5 / 100
266 ms 157176 KB
#include <bits/stdc++.h>
#define MAXN 100005
#define MOD 1000000007
using namespace std;
long long  dp[MAXN][100], fib[100];
long long X (int pk)
{
    return dp[pk][50]%MOD;
}
void precompute()
{
    fib[1]=1;
    fib[2]=2;
    for (int i=3;i<=50;i++)
        fib[i]=fib[i - 1]+fib[i - 2];
    for (int i=0;i<=50;i++)
        {
            dp[1][i]=1;
            dp[0][i]=1;
        }
    dp[1][0]=0;
    for (int i=2;i<100000;i++)
        {
            for (int j=1;j<= 50;j++)
            {
                dp[i][j]=dp[i][j - 1]%MOD;
                if (fib[j] <= i)dp[i][j]+=(dp[i - fib[j]][j - 1])%MOD;
                dp[i][j]%=MOD;
            }
        }
}
int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    precompute();
    int n;
    cin>>n;
    long long pk=0;
    while(n--)
        {
            int x;
            cin>>x;
            pk+=fib[x];
            cout<<X(pk)<<endl;
        }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 139 ms 78720 KB Output is correct
2 Correct 141 ms 78588 KB Output is correct
3 Correct 142 ms 78596 KB Output is correct
4 Correct 140 ms 78584 KB Output is correct
5 Correct 140 ms 78556 KB Output is correct
6 Correct 144 ms 78584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 139 ms 78720 KB Output is correct
2 Correct 141 ms 78588 KB Output is correct
3 Correct 142 ms 78596 KB Output is correct
4 Correct 140 ms 78584 KB Output is correct
5 Correct 140 ms 78556 KB Output is correct
6 Correct 144 ms 78584 KB Output is correct
7 Correct 226 ms 78736 KB Output is correct
8 Runtime error 246 ms 157176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 266 ms 157148 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 139 ms 78720 KB Output is correct
2 Correct 141 ms 78588 KB Output is correct
3 Correct 142 ms 78596 KB Output is correct
4 Correct 140 ms 78584 KB Output is correct
5 Correct 140 ms 78556 KB Output is correct
6 Correct 144 ms 78584 KB Output is correct
7 Correct 226 ms 78736 KB Output is correct
8 Runtime error 246 ms 157176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 237 ms 157152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 139 ms 78720 KB Output is correct
2 Correct 141 ms 78588 KB Output is correct
3 Correct 142 ms 78596 KB Output is correct
4 Correct 140 ms 78584 KB Output is correct
5 Correct 140 ms 78556 KB Output is correct
6 Correct 144 ms 78584 KB Output is correct
7 Correct 226 ms 78736 KB Output is correct
8 Runtime error 246 ms 157176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -