提出 #71492279


ソースコード 拡げる

#include<bits/stdc++.h>
//#include<iostream>
//#include<cmath>
//#include<string>
//#include<string.h>
//#include<math.h>
//#include<float.h>
using namespace std;
#define int long long
int n;
int a[500010];
void solve(){
	cin >> n;
	for(int i = 1;i <= n;i++)
		cin >> a[i];
	int mx = 1;
	for(int i = 1;i <= n;i++){
		mx = max(mx,i + a[i] - 1);
		if(mx == i)
			break;
//		cout << mx << " ";
	}
	cout << min(mx,n);
}
signed main(){
	int T = 1;
//	cin >> T;
	while(T--)
		solve();
	return 0;
}

提出情報

提出日時
問題 C - Domino
ユーザ Eirck
言語 C++23 (GCC 15.2.0)
得点 300
コード長 521 Byte
結果 AC
実行時間 86 ms
メモリ 7556 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 3520 KiB
random_01.txt AC 85 ms 7252 KiB
random_02.txt AC 31 ms 5164 KiB
random_03.txt AC 84 ms 7556 KiB
random_04.txt AC 16 ms 4052 KiB
random_05.txt AC 80 ms 7332 KiB
random_06.txt AC 80 ms 7172 KiB
random_07.txt AC 81 ms 7468 KiB
random_08.txt AC 44 ms 5540 KiB
random_09.txt AC 81 ms 7300 KiB
random_10.txt AC 63 ms 6584 KiB
random_11.txt AC 80 ms 7288 KiB
random_12.txt AC 23 ms 4652 KiB
random_13.txt AC 40 ms 7540 KiB
random_14.txt AC 86 ms 7348 KiB
random_15.txt AC 84 ms 7556 KiB
random_16.txt AC 84 ms 7416 KiB
sample_01.txt AC 1 ms 3332 KiB
sample_02.txt AC 1 ms 3472 KiB
sample_03.txt AC 1 ms 3304 KiB