Submission #71476479


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

signed main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++ i ) cin >> a[i];
	int res = 1, mx = a[0] - 1;
	for (int i = 1; i < n; ++ i ) {
		if (i <= mx) res ++, mx = max(mx, i + a[i] - 1);
	}
	cout << res;
	return 0;
}

Submission Info

Submission Time
Task C - Domino
User huk2
Language C++23 (GCC 15.2.0)
Score 300
Code Size 303 Byte
Status AC
Exec Time 95 ms
Memory 5352 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
min.txt AC 2 ms 3496 KiB
random_01.txt AC 92 ms 5340 KiB
random_02.txt AC 34 ms 4060 KiB
random_03.txt AC 92 ms 5280 KiB
random_04.txt AC 18 ms 3660 KiB
random_05.txt AC 88 ms 5228 KiB
random_06.txt AC 88 ms 5200 KiB
random_07.txt AC 89 ms 5332 KiB
random_08.txt AC 48 ms 4436 KiB
random_09.txt AC 89 ms 5352 KiB
random_10.txt AC 69 ms 4820 KiB
random_11.txt AC 88 ms 5336 KiB
random_12.txt AC 25 ms 3920 KiB
random_13.txt AC 44 ms 5212 KiB
random_14.txt AC 95 ms 5212 KiB
random_15.txt AC 91 ms 5332 KiB
random_16.txt AC 91 ms 5328 KiB
sample_01.txt AC 1 ms 3592 KiB
sample_02.txt AC 1 ms 3648 KiB
sample_03.txt AC 1 ms 3552 KiB