|
||||||||||
A Sequence GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1526 Accepted Submission(s): 300 Problem Description One day, WNJXYK found a very hard problem on an Online Judge. This problem is so hard that he had been thinking about the solutions for a couple of days. And then he had a surprise that he misunderstood that problem and easily figured out a solution using segment tree. Now he still wonders that solution for the misread problem. There is a sequence with $N$ positive integers $A1$,$A2$,...,$An$ and $M$ queries. Each query will give you an interval [L,R] and require an answer with YES/NO indicates that whether the numbers in this interval are continuous in its integer range. Let us assume that the maximal number in an interval is $mx$ and the minimal number is $mi$. The numbers in this interval are continuous in its integer range means that each number from $mi$ to $mx$ appears at least once in this interval. Input The input starts with one line contains exactly one positive integer $T$ which is the number of test cases. And then there are T cases follow. The first line contains two positive integers $n$,$m$ which has been explained above.The second line contains positive integers $A1$,$A2$,...,$An$. Then there will be m lines followed. Each line contains to positive numbers $Li$,$Ri$ indicating that the ith query’s interval is [$Li$,$Ri$]. Output For each test case, output m line. Each of following m lines contains a single string “YES”/ “NO” which is the answer you have got. Sample Input
Sample Output
Hint T=5 1<=n<=100000 1<=Ai<=10^9 1<=m<=100000 The input file is very large, so you are recommend to use scanf() and printf() for IO. Source | ||||||||||
|