87962024-01-31 08:43:09CWMLudak Harcacpp17Accepted 100/10014ms4920 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <queue>
#include <set>
#include <map>

using namespace std;

signed main()
{
	{
		ios_base::sync_with_stdio(0);
		cin.tie(0);
		cout.tie(0);
	}

	int n;
	cin >> n;
	vector<int> gates(n);
	for (size_t i = 0; i < n; i++)
	{
		cin >> gates[i];
	}
	for (size_t i = 1; i <= 6; i++)
	{
		int cur = 0;
		int turns = 0;
		while (cur < n) {
			cur += i;
			while(cur<n && gates[cur]!=0) cur += gates[cur];
			turns++;
		}
		cout << turns << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1976 KiB
2Accepted3ms2104 KiB
subtask225/25
3Accepted3ms2320 KiB
4Accepted3ms2464 KiB
5Accepted3ms2556 KiB
6Accepted3ms2752 KiB
7Accepted10ms3716 KiB
subtask340/40
8Accepted3ms3112 KiB
9Accepted3ms3104 KiB
10Accepted4ms3392 KiB
11Accepted4ms3380 KiB
12Accepted7ms3476 KiB
13Accepted9ms3604 KiB
14Accepted12ms4128 KiB
15Accepted13ms4472 KiB
subtask435/35
16Accepted4ms3912 KiB
17Accepted4ms4228 KiB
18Accepted6ms4312 KiB
19Accepted7ms4252 KiB
20Accepted8ms4268 KiB
21Accepted8ms4280 KiB
22Accepted10ms4252 KiB
23Accepted12ms4504 KiB
24Accepted12ms4920 KiB
25Accepted14ms4848 KiB