| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 1024 MB | 109 | 34 | 32 | 38.095% |
Let’s call an array of integers $[b_1, b_2, \dots , b_m]$ good, if we can partition all of its elements into 2ドル$ nonempty groups, such that the bitwise $\texttt{AND}$ of the elements in the first group is equal to the bitwise $\texttt{OR}$ of the elements in the second group. For example, the array $[1, 7, 3, 11]$ is good, as we can partition it into $[1, 3]$ and $[7, 11],ドル where 1ドル \texttt{ OR } 3 = 3,ドル and 7ドル\texttt{ AND }11 = 3$.
You are given an array $[a_1, a_2, \dots , a_n],ドル and have to answer $q$ queries of form: is subarray $[a_l , a_{l+1}, \dots , a_r]$ good?
The first line of the input contains two integer $n,ドル $q$ (1ドル \le n \le 10^5,ドル 1ドル \le q \le 10^5$) — the length of the array and the number of the associated queries.
The second line of the input contains $n$ integers $a_1, a_2, \dots , a_n$ (0ドル \le a_i \le 2^{30} - 1$) — the elements of the array.
The $i$-th of the next $q$ lines contains 2ドル$ integers $l_i,ドル $r_i$ (1ドル \le l_i \le r_i \le n$) — describing the $i$-th query.
For each query, output YES, if the correspondent subarray is good, and NO, if it’s not.
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