luogu#P3901. 数列找不同

数列找不同

Problem Description

Given a sequence A1,A2,,ANA_1, A_2, \ldots, A_N and QQ queries (Li,Ri)(L_i, R_i), determine whether ALi,ALi+1,,ARiA_{L_i}, A_{L_i+1}, \ldots, A_{R_i} are all different from each other.

Input Format

The first line contains two integers N,QN, Q.
The second line contains NN integers A1,A2,,ANA_1, A_2, \ldots, A_N.
Then QQ lines follow, each containing two integers Li,RiL_i, R_i.

Output Format

For each query, output one line: Yes or No.

4 2
1 2 3 2
1 3
2 4
Yes
No

Hint

For 50%50\% of the testdata, N,Q103N, Q \le 10^3.
For 100%100\% of the testdata, 1N,Q1051 \le N, Q \le 10^5, 1AiN1 \le A_i \le N, 1LiRiN1 \le L_i \le R_i \le N.

Translated by ChatGPT 5