You are viewing a single comment's thread. Return to all comments →
for _ in range(int(input())): int(input()) p=list(map(int,(input().split()))) c=0 b=-1 t=0 for i in range(len(p)): if i==0: if p[i+c]>=p[b]: d=p[i+c] elif p[b]>p[i+c]: d=p[b] b-=1 c-=1 elif i>0: if p[i+c]>=p[b] and p[i+c]<=d and p[b]<=d: d=p[i+c] t=1 elif p[i+c]>=p[b] and p[i+c]>d and p[b]>d: t=0 elif p[i+c]<p[b] and p[i+c]>d and p[b]>d: t=0 elif p[i+c]<p[b] and p[i+c]<=d and p[b]<=d: d=p[b] b-=1 c-=1 t=1 if t ==0: print('No') elif t==1: print('Yes')
Seems like cookies are disabled on this browser, please enable them to open this website
Piling Up!
You are viewing a single comment's thread. Return to all comments →