124212024-12-17 14:39:2142Síkság (55)python3Wrong answer 39/55190ms14996 KiB
input()
A=list(map(int,input().split()))
S=0
L=1
d={A[0]:1}
R=0
for i in range(1,len(A)):
 d[A[i]]=d.get(A[i],0)+1
 while len(d)>2:
  d[A[R]]-=1
  if d[A[R]]==0:del d[A[R]]
  R+=1
  B=list(d.keys())
  if len(B)==2:
   if abs(B[0]-B[1])>1:
    while len(d)>1:
     d[A[R]]-=1
     if d[A[R]]==0:del d[A[R]]
     R+=1
 if i-R+1>L:L,S=i-R+1,R
print(L,S+1)
SubtaskSumTestVerdictTimeMemory
base39/55
1Accepted0/016ms3100 KiB
2Accepted0/032ms4152 KiB
3Wrong answer0/216ms3128 KiB
4Accepted2/216ms3128 KiB
5Wrong answer0/216ms3084 KiB
6Accepted2/216ms3136 KiB
7Accepted3/316ms3172 KiB
8Accepted2/217ms3228 KiB
9Accepted3/317ms3128 KiB
10Accepted3/332ms4152 KiB
11Accepted3/329ms3720 KiB
12Accepted3/325ms3896 KiB
13Wrong answer0/3166ms14996 KiB
14Accepted3/3165ms5036 KiB
15Accepted3/3172ms11544 KiB
16Accepted3/3171ms14632 KiB
17Wrong answer0/3172ms14592 KiB
18Wrong answer0/3190ms14560 KiB
19Accepted3/3174ms14620 KiB
20Accepted3/3187ms14488 KiB
21Accepted3/3100ms8800 KiB
22Wrong answer0/3143ms12068 KiB