#P10743. [SEERC 2020] AND = OR
[SEERC 2020] AND = OR
Problem Description
An array is called a "good array" if and only if can be split into two non-empty subarrays such that the result of the first subarray is equal to the result of the second subarray. For example, for , split it into and . Then and , so it is a good array.
Now you are given an array of length and queries. In each query, given , determine whether is a good array.
Input Format
The first line contains two integers and .
The second line contains integers representing the sequence .
The next lines each contain two integers , representing a query.
Output Format
For each query, if the subarray is good, output YES; otherwise output NO.
5 15
0 1 1 3 2
1 1
1 2
1 3
1 4
1 5
2 2
2 3
2 4
2 5
3 3
3 4
3 5
4 4
4 5
5 5
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
Hint
Translated by ChatGPT 5