113822024-08-29 14:07:19MCDaveLudak Harcacpp17Accepted 100/10034ms1528 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, i, x=0, out[6], position, round;
    cin >> n;
    vector<int> map(n);

    for (i = 0; i < n; i++)
    {
        cin >> map[i];
    }

    for (i = 0; i < 6; i++)
    {
        x++, round = 0, position = 0;
        while (map[position] != 0)
        {
            position += map[position];
        }
        while (position < n)
        {
            position += x;
            round++;
            while (position < n && map[position] != 0)
            {
                position += map[position];
            }
        }
        out[i] = round;
    }

    for (i = 0; i < 6; i++)
    {
        cout << out[i] << ' ';
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted2ms360 KiB
2Accepted2ms384 KiB
subtask225/25
3Accepted2ms256 KiB
4Accepted3ms360 KiB
5Accepted3ms360 KiB
6Accepted4ms488 KiB
7Accepted19ms1144 KiB
subtask340/40
8Accepted2ms360 KiB
9Accepted4ms360 KiB
10Accepted4ms396 KiB
11Accepted8ms488 KiB
12Accepted12ms748 KiB
13Accepted20ms920 KiB
14Accepted25ms1020 KiB
15Accepted28ms1136 KiB
subtask435/35
16Accepted4ms488 KiB
17Accepted8ms684 KiB
18Accepted10ms760 KiB
19Accepted14ms744 KiB
20Accepted14ms888 KiB
21Accepted20ms944 KiB
22Accepted24ms1000 KiB
23Accepted27ms1148 KiB
24Accepted26ms1128 KiB
25Accepted34ms1528 KiB