Submission #73496044


Source Code Expand

N=int(input())
A=list(map(int,input().split()))
G=[]
last=0
S=set()
T=set()
R={}
X=0
for i in range(N) :
    if A[i] in S :
        G[R[A[i]]][1]+=1
        S.discard(A[i])
        S.add(A[i]+1)
        T.add(A[i])
        R[A[i]+1]=R[A[i]]
    elif not A[i] in T :
        T.add(A[i])
        G.append([A[i],A[i]])
        R[A[i]+1]=last
        S.add(A[i]+1)
        last+=1
ans=0
for i in range(len(G)) :
    ans=max(ans,G[i][1]-G[i][0]+1)
print(ans)

Submission Info

Submission Time
Task D - Max Straight
User Youteru
Language Python (PyPy 3.11-v7.3.20)
Score 400
Code Size 477 Byte
Status AC
Exec Time 162 ms
Memory 218240 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 47 ms 79632 KiB
00_sample_01.txt AC 46 ms 79736 KiB
00_sample_02.txt AC 46 ms 79724 KiB
01_random_00.txt AC 46 ms 79748 KiB
01_random_01.txt AC 46 ms 79544 KiB
01_random_02.txt AC 45 ms 79836 KiB
01_random_03.txt AC 114 ms 170092 KiB
01_random_04.txt AC 118 ms 172860 KiB
01_random_05.txt AC 116 ms 161060 KiB
01_random_06.txt AC 86 ms 143964 KiB
01_random_07.txt AC 162 ms 218240 KiB
01_random_08.txt AC 67 ms 108472 KiB
01_random_09.txt AC 49 ms 80540 KiB
01_random_10.txt AC 85 ms 139168 KiB
01_random_11.txt AC 82 ms 137272 KiB
01_random_12.txt AC 56 ms 92348 KiB
01_random_13.txt AC 86 ms 138576 KiB
01_random_14.txt AC 52 ms 88152 KiB
01_random_15.txt AC 84 ms 139960 KiB
01_random_16.txt AC 69 ms 115484 KiB
01_random_17.txt AC 121 ms 202036 KiB
01_random_18.txt AC 129 ms 201176 KiB
01_random_19.txt AC 130 ms 201612 KiB
01_random_20.txt AC 104 ms 165152 KiB
01_random_21.txt AC 134 ms 201776 KiB
01_random_22.txt AC 60 ms 97032 KiB