Submission #389173

# Submission time Handle Problem Language Result Execution time Memory
389173 2021-04-13T19:28:17 Z Ahmad_Hasan Calvinball championship (CEOI15_teams) C++17
10 / 100
783 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;

    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]++;
        }
    }
/***
    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]];

    cout<<ans+1<<'\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 91 ms 2300 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 783 ms 4232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 65540 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 36 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -