It’s very simple and tricky problem, My AC solution :
n,q = map(int,input().split()) a = list(map(int,input().split())) for _ in range(q): l,r = map(int,input().split()) if (a[l-1]<a[l] and a[r-2]<a[r-1]) or (a[l-1]>a[l] and a[r-2]>a[r-1]): print('NO') else: print('YES')
it’s so simple. can you explain? please
Sorry I am not good in writing editorial, hope you will understand by following images. Correct me if you find anything wrong (you may find spelling mistakes as well).
Wow cool thank’s a lot. it was very simple