6270 | 2023-11-10 20:49:07 | horka | Ludak Harca | cpp17 | Accepted 100/100 | 43ms | 18716 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2004 KiB | ||||
subtask2 | 25/25 | ||||||
3 | Accepted | 3ms | 2248 KiB | ||||
4 | Accepted | 3ms | 2340 KiB | ||||
5 | Accepted | 3ms | 2736 KiB | ||||
6 | Accepted | 4ms | 3972 KiB | ||||
7 | Accepted | 32ms | 17448 KiB | ||||
subtask3 | 40/40 | ||||||
8 | Accepted | 3ms | 3164 KiB | ||||
9 | Accepted | 4ms | 3480 KiB | ||||
10 | Accepted | 6ms | 4552 KiB | ||||
11 | Accepted | 9ms | 6188 KiB | ||||
12 | Accepted | 17ms | 9260 KiB | ||||
13 | Accepted | 28ms | 13768 KiB | ||||
14 | Accepted | 35ms | 16760 KiB | ||||
15 | Accepted | 39ms | 18376 KiB | ||||
subtask4 | 35/35 | ||||||
16 | Accepted | 7ms | 5800 KiB | ||||
17 | Accepted | 9ms | 6740 KiB | ||||
18 | Accepted | 14ms | 8508 KiB | ||||
19 | Accepted | 17ms | 9756 KiB | ||||
20 | Accepted | 19ms | 11320 KiB | ||||
21 | Accepted | 27ms | 12880 KiB | ||||
22 | Accepted | 29ms | 14292 KiB | ||||
23 | Accepted | 35ms | 15980 KiB | ||||
24 | Accepted | 35ms | 17160 KiB | ||||
25 | Accepted | 43ms | 18716 KiB |