Submission #389175

# Submission time Handle Problem Language Result Execution time Memory
389175 2021-04-13T19:32:52 Z Ahmad_Hasan Calvinball championship (CEOI15_teams) C++17
10 / 100
270 ms 65540 KB
#include <bits/stdc++.h>

using namespace std;



int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];

    int dp[n][n+5];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++)
        dp[n-1][i]=i-1;
    int mod=1e6+7;
    for(int i=n-2;i>=0;i--){
        for(int j=2;j<=n;j++){
            dp[i][j]=dp[i][j-1];
            for(int k=i+1;k<n;k++){
                dp[i][j]+=dp[k][j-1+(k-(i))];
                dp[i][j]%=mod;
            }
            dp[i][j]++;
            dp[i][j]%=mod;
        }
    }
/***
    for(int i=0;i<n;i++){
        for(int j=1;j<=n;j++)
            cout<<dp[i][j]<<' ';
        cout<<'\n';
    }*/

    int ans=0;
    for(int i=0;i<n;i++){
        ans+=dp[i][v[i]];
        ans%=mod;
    }

    cout<<(ans+1)%mod<<'\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 270 ms 1280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 250 ms 8320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 37 ms 65540 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -