Submission #71476575


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf = 2000000000000000000;
signed main(){
    int n;cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)cin>>a[i];
    int ma=a[1];
    int k=1;
    for(int i=2;i<=n;i++){
        if(i<=ma){
            ma=max(ma,i+a[i]-1);
            k=i;
        }
    }
    cout<<k<<"\n";
}

Submission Info

Submission Time
Task C - Domino
User Sabakanmelm
Language C++23 (GCC 15.2.0)
Score 300
Code Size 368 Byte
Status AC
Exec Time 92 ms
Memory 7608 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 1 ms 3460 KiB
random_01.txt AC 90 ms 7436 KiB
random_02.txt AC 33 ms 4996 KiB
random_03.txt AC 90 ms 7428 KiB
random_04.txt AC 17 ms 4236 KiB
random_05.txt AC 86 ms 7428 KiB
random_06.txt AC 86 ms 7204 KiB
random_07.txt AC 87 ms 7608 KiB
random_08.txt AC 47 ms 5644 KiB
random_09.txt AC 87 ms 7380 KiB
random_10.txt AC 68 ms 6600 KiB
random_11.txt AC 87 ms 7428 KiB
random_12.txt AC 24 ms 4816 KiB
random_13.txt AC 43 ms 7608 KiB
random_14.txt AC 92 ms 7420 KiB
random_15.txt AC 89 ms 7580 KiB
random_16.txt AC 89 ms 7428 KiB
sample_01.txt AC 1 ms 3464 KiB
sample_02.txt AC 1 ms 3664 KiB
sample_03.txt AC 1 ms 3556 KiB