Wrong Answer
Code
t = int(input())
for i in range(t):
n=int(input())
q=[]
s=list(map(int,input().split()))
start = False
count=0
len=0
max_len=0
for j in range(n):
if s[j]==1:
start= True
count+=1
max_len=max(count,max_len)
elif s[j]==3 and start :
count+=1
max_len=max(count,max_len)
elif s[j]==2:
q.append(count)
max_len=count
count=0
start= False
elif start :
count+=1
max_len=max(count,max_len)
print(max_len)
Information
- Submit By
- Type
- Submission
- Problem
- P1036 Perfect subarray
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-03-14 14:15:02
- Judged At
- 2024-03-14 14:15:02
- Judged By
- Score
- 25
- Total Time
- 68ms
- Peak Memory
- 5.25 MiB