ISBIAS: Need help

Hello codechef’s community,
Please i need help to find what wrong in my solution of ISBIAS problem. I use segment tree and here is my solution

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]):

:flushed::flushed: 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).

1 Like

Wow cool thank’s a lot. it was very simple :slightly_smiling_face: