Submission #71484094


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int maxn=a[0];
    int cu=1;
    while(cu<=maxn&&cu<=n)
    {
        int nr=cu+a[cu-1]-1;
        maxn=max(maxn,nr);
        cu++;
    }
    cout<<min(maxn,n)<<endl;
    return 0;
}

Submission Info

Submission Time
Task C - Domino
User jiqihang
Language C++23 (GCC 15.2.0)
Score 300
Code Size 343 Byte
Status AC
Exec Time 84 ms
Memory 5380 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 3456 KiB
random_01.txt AC 82 ms 5204 KiB
random_02.txt AC 31 ms 4044 KiB
random_03.txt AC 82 ms 5380 KiB
random_04.txt AC 15 ms 3656 KiB
random_05.txt AC 79 ms 5332 KiB
random_06.txt AC 78 ms 5176 KiB
random_07.txt AC 80 ms 5380 KiB
random_08.txt AC 43 ms 4376 KiB
random_09.txt AC 79 ms 5332 KiB
random_10.txt AC 62 ms 4796 KiB
random_11.txt AC 78 ms 5308 KiB
random_12.txt AC 22 ms 3972 KiB
random_13.txt AC 39 ms 5332 KiB
random_14.txt AC 84 ms 5296 KiB
random_15.txt AC 82 ms 5308 KiB
random_16.txt AC 82 ms 5332 KiB
sample_01.txt AC 1 ms 3404 KiB
sample_02.txt AC 1 ms 3500 KiB
sample_03.txt AC 1 ms 3420 KiB