CF279C Ladder
Description
You'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
Input Format
The first line contains two integers $ n $ and $ m $ $ (1
Output Format
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.