Submission #73500759


Source Code Expand

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

int main(){
    int n;
    cin>>n;
    map<long long,int> m;
    vector<int> a(n + 1);
    int ans=1;
    if(n==0){
        cout<<0;
        return 0;
    }
    for(int i=1;i<=n;i++){
    	cin>>a[i];
        m[a[i]]=m[a[i]-1]+1;
        ans=max(m[a[i]],ans);

    }
    cout<<ans;
}

Submission Info

Submission Time
Task D - Max Straight
User chenhany
Language C++23 (GCC 15.2.0)
Score 400
Code Size 348 Byte
Status AC
Exec Time 182 ms
Memory 29124 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 26
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3464 KiB
00_sample_01.txt AC 1 ms 3456 KiB
00_sample_02.txt AC 1 ms 3496 KiB
01_random_00.txt AC 1 ms 3588 KiB
01_random_01.txt AC 1 ms 3576 KiB
01_random_02.txt AC 1 ms 3428 KiB
01_random_03.txt AC 110 ms 16576 KiB
01_random_04.txt AC 123 ms 16652 KiB
01_random_05.txt AC 97 ms 18364 KiB
01_random_06.txt AC 44 ms 11136 KiB
01_random_07.txt AC 182 ms 29124 KiB
01_random_08.txt AC 27 ms 3680 KiB
01_random_09.txt AC 1 ms 3560 KiB
01_random_10.txt AC 65 ms 4164 KiB
01_random_11.txt AC 68 ms 4168 KiB
01_random_12.txt AC 7 ms 3716 KiB
01_random_13.txt AC 73 ms 4300 KiB
01_random_14.txt AC 2 ms 3736 KiB
01_random_15.txt AC 82 ms 4452 KiB
01_random_16.txt AC 42 ms 4056 KiB
01_random_17.txt AC 83 ms 16572 KiB
01_random_18.txt AC 80 ms 16208 KiB
01_random_19.txt AC 89 ms 16596 KiB
01_random_20.txt AC 60 ms 12612 KiB
01_random_21.txt AC 103 ms 16600 KiB
01_random_22.txt AC 9 ms 4580 KiB