145622025-01-16 10:11:17TortelliniJrLudak Harcacpp17Accepted 100/10030ms1488 KiB
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, x;
    cin >> n;
    vector<int> target;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        target.push_back(x);
    }
    vector<int> sol(8);
    int pos;
    for (int i = 1; i <= 6; i++)
    {
        pos = 0;
        while(pos < n)
        {
            pos += i;
            sol[i]++;
            if (pos >= n)
            {
                break;
            }
            while (target[pos] > 0)
            {
                pos += target[pos];
                if (pos > n)
                {
                    break;
                }
            }
        }
    }
    for (int i = 1; i <= 6; i++)
    {
        cout << sol[i] << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Accepted1ms508 KiB
subtask225/25
3Accepted1ms316 KiB
4Accepted1ms408 KiB
5Accepted1ms316 KiB
6Accepted3ms316 KiB
7Accepted18ms1200 KiB
subtask340/40
8Accepted1ms316 KiB
9Accepted2ms316 KiB
10Accepted4ms316 KiB
11Accepted6ms564 KiB
12Accepted10ms796 KiB
13Accepted18ms1140 KiB
14Accepted24ms1396 KiB
15Accepted26ms1348 KiB
subtask435/35
16Accepted4ms508 KiB
17Accepted6ms748 KiB
18Accepted8ms564 KiB
19Accepted12ms820 KiB
20Accepted14ms824 KiB
21Accepted17ms1056 KiB
22Accepted20ms1196 KiB
23Accepted24ms1400 KiB
24Accepted24ms1200 KiB
25Accepted30ms1488 KiB