124202024-12-17 14:38:4342Síkság (55)pypy3Wrong answer 24/55108ms32000 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
base24/55
1Accepted0/045ms19644 KiB
2Accepted0/086ms23248 KiB
3Wrong answer0/241ms19412 KiB
4Accepted2/241ms19528 KiB
5Wrong answer0/246ms19576 KiB
6Accepted2/241ms19624 KiB
7Accepted3/341ms19556 KiB
8Accepted2/257ms21484 KiB
9Accepted3/357ms21428 KiB
10Accepted3/368ms22648 KiB
11Accepted3/368ms22752 KiB
12Accepted3/357ms21484 KiB
13Runtime error0/379ms32000 KiB
14Runtime error0/364ms32000 KiB
15Runtime error0/375ms32000 KiB
16Runtime error0/368ms32000 KiB
17Runtime error0/379ms32000 KiB
18Runtime error0/379ms32000 KiB
19Runtime error0/368ms32000 KiB
20Runtime error0/376ms32000 KiB
21Accepted3/3108ms27380 KiB
22Wrong answer0/397ms31436 KiB