Alex and his corgi are going on a hike! They are traversing a 1-dimensional hiking path of length $$$N$$$ where each position $$$i\ (1 \leq i \leq N)$$$ has elevation $$$e_i$$$.
He's curious about the view at different locations along the hike. Specifically, he has $$$q$$$ queries where he's wondering if location $$$j$$$ is visible from location $$$i$$$, which is the case when there's no location between $$$i$$$ and $$$j$$$ with an elevation greater than or equal to the max of $$$e_i$$$ and $$$e_j$$$. For each query, determine if location $$$j$$$ is visible from location $$$i$$$.
The first line will contain two space-separated integers, $$$N\ (1 \leq N \leq 10^5)$$$ and $$$q\ (1 \leq q \leq 100)$$$, denoting the length of the hiking path and the number of queries, respectively.
The second line will contain $$$N$$$ space separated integers $$$e_1, e_2, \dots e_N\ (1 \leq e_i \leq 10^9)$$$ representing the elevations of the $$$N$$$ positions in the hiking path.
The final $$$q$$$ lines will each contain two space-separated integers $$$i$$$ and $$$j\ (1 \leq i, j \leq N)$$$, representing a query.
Output $$$q$$$ lines, each containing a single string "yes" or "no" (case insensitive), representing the result of a query.
9 69 6 3 3 4 6 1 4 81 61 33 43 75 86 9
yes yes yes no no yes
| Name |
|---|


