提出 #71553446


ソースコード 拡げる

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int a[500005];

int main()
{
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++) cin >> a[i];
	int now = 1,cnt = 0;
	for(int i = 1;i <= n;i++)
		if(i <= now)
		{
			now = max(i + a[i] - 1,now);
			cnt++;
		}
		else break;
	cout << cnt << endl;
}

提出情報

提出日時
問題 C - Domino
ユーザ rgr2025
言語 C++23 (GCC 15.2.0)
得点 300
コード長 341 Byte
結果 AC
実行時間 100 ms
メモリ 5608 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 20
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
min.txt AC 1 ms 3540 KiB
random_01.txt AC 98 ms 5328 KiB
random_02.txt AC 36 ms 4336 KiB
random_03.txt AC 98 ms 5564 KiB
random_04.txt AC 18 ms 3736 KiB
random_05.txt AC 93 ms 5512 KiB
random_06.txt AC 93 ms 5364 KiB
random_07.txt AC 95 ms 5604 KiB
random_08.txt AC 51 ms 4696 KiB
random_09.txt AC 94 ms 5516 KiB
random_10.txt AC 74 ms 5080 KiB
random_11.txt AC 93 ms 5600 KiB
random_12.txt AC 26 ms 3992 KiB
random_13.txt AC 46 ms 5608 KiB
random_14.txt AC 100 ms 5564 KiB
random_15.txt AC 98 ms 5212 KiB
random_16.txt AC 97 ms 5600 KiB
sample_01.txt AC 1 ms 3352 KiB
sample_02.txt AC 1 ms 3556 KiB
sample_03.txt AC 1 ms 3296 KiB