62702023-11-10 20:49:07horkaLudak Harcacpp17Accepted 100/10043ms18716 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n; cin>>n;
    vector<int> v(n+1);
    vector<vector<int>> dp(n+1, vector<int> (7));
    for(int i=1; i<=n; i++)
        cin>>v[i];
    for(int i=1; i<=6; i++)
        if(v[n]==0) dp[n][i]=1;
    for(int i=n-1; i>0; i--)
    {
        if(v[i]==0 || i==1)
        {
            for(int j=1; j<=6; j++)
                i+j>n ? dp[i][j]=1 : dp[i][j]=dp[i+j][j]+1;
        }
        else
        {
            for(int j=1; j<=6; j++)
            {
                if(i+v[i]>n) dp[i][j]=0;
                else dp[i][j]=dp[i+v[i]][j];
            }
        }
    }
    for(int i=1; i<=6; i++)
        cout<<dp[1][i]<<" ";
    cout<<endl;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2004 KiB
subtask225/25
3Accepted3ms2248 KiB
4Accepted3ms2340 KiB
5Accepted3ms2736 KiB
6Accepted4ms3972 KiB
7Accepted32ms17448 KiB
subtask340/40
8Accepted3ms3164 KiB
9Accepted4ms3480 KiB
10Accepted6ms4552 KiB
11Accepted9ms6188 KiB
12Accepted17ms9260 KiB
13Accepted28ms13768 KiB
14Accepted35ms16760 KiB
15Accepted39ms18376 KiB
subtask435/35
16Accepted7ms5800 KiB
17Accepted9ms6740 KiB
18Accepted14ms8508 KiB
19Accepted17ms9756 KiB
20Accepted19ms11320 KiB
21Accepted27ms12880 KiB
22Accepted29ms14292 KiB
23Accepted35ms15980 KiB
24Accepted35ms17160 KiB
25Accepted43ms18716 KiB