Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Ladder

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou've got an array, consisting of *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n}. Also, you've got *m* queries, the *i*-th query is described by two integers *l*_{i}, *r*_{i}. Numbers *l*_{i}, *r*_{i} define a subsegment of the original array, that is, the sequence of numbers *a*_{li}, *a*_{li + 1}, *a*_{li + 2}, ..., *a*_{ri}. For each query you should check whether the corresponding segment is a ladder.

A ladder is a sequence of integers *b*_{1}, *b*_{2}, ..., *b*_{k}, such that it first doesn't decrease, then doesn't increase. In other words, there is such integer *x* (1 ≤ *x* ≤ *k*), that the following inequation fulfills: *b*_{1} ≤ *b*_{2} ≤ ... ≤ *b*_{x} ≥ *b*_{x + 1} ≥ *b*_{x + 2}... ≥ *b*_{k}. Note that the non-decreasing and the non-increasing sequences are also considered ladders.

Input

The first line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 10^{5}) — the number of array elements and the number of queries. The second line contains the sequence of integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{9}), where number *a*_{i} stands for the *i*-th array element.

The following *m* lines contain the description of the queries. The *i*-th line contains the description of the *i*-th query, consisting of two integers *l*_{i}, *r*_{i} (1 ≤ *l*_{i} ≤ *r*_{i} ≤ *n*) — the boundaries of the subsegment of the initial array.

The numbers in the lines are separated by single spaces.

Output

Print *m* lines, in the *i*-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the *i*-th query is the ladder, or word "No" (without the quotes) otherwise.

Examples

Input

8 6

1 2 1 3 3 5 2 1

1 3

2 3

2 4

8 8

1 4

5 8

Output

Yes

Yes

No

Yes

No

Yes

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/16/2021 06:27:50 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|