Logo
(追記) (追記ここまで)

21912번 - AND = OR 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB109343238.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.

제한

예제 입력 1

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

예제 출력 1

NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2020 H번

Contest > Open Cup > 2020/2021 Season > Stage 17: Grand Prix of Southern Europe H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /