提出 #71506698


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	vector<int> v(n + 1);

	for (int i = 1; i <= n; i++) {
		cin >> v[i];
	}

	int dist = v[1];

	int i = 1;

	while (i <= dist) {
		if (i > n) {
			break;
		}
		dist = max(dist, i + v[i] - 1);
		i++;
	}

	cout << min(dist, n);

	return 0;
}

提出情報

提出日時
問題 C - Domino
ユーザ mollusca
言語 C++23 (GCC 15.2.0)
得点 300
コード長 346 Byte
結果 AC
実行時間 84 ms
メモリ 5376 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 3468 KiB
random_01.txt AC 82 ms 5364 KiB
random_02.txt AC 30 ms 3980 KiB
random_03.txt AC 82 ms 5260 KiB
random_04.txt AC 15 ms 3700 KiB
random_05.txt AC 79 ms 5308 KiB
random_06.txt AC 78 ms 5168 KiB
random_07.txt AC 79 ms 5260 KiB
random_08.txt AC 43 ms 4356 KiB
random_09.txt AC 79 ms 5304 KiB
random_10.txt AC 62 ms 4692 KiB
random_11.txt AC 79 ms 5372 KiB
random_12.txt AC 22 ms 3944 KiB
random_13.txt AC 39 ms 5252 KiB
random_14.txt AC 84 ms 5352 KiB
random_15.txt AC 82 ms 5376 KiB
random_16.txt AC 82 ms 5252 KiB
sample_01.txt AC 1 ms 3516 KiB
sample_02.txt AC 1 ms 3468 KiB
sample_03.txt AC 1 ms 3580 KiB