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

33267번 - Huge Sequences 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB0000.000%

문제

Given three sequences $a_1, \ldots, a_n,ドル $b_1, \ldots, b_n,ドル and $c_1, \ldots, c_n,ドル define the value of the interval $[\ell, r]$ as the product of three factors:

  • the bitwise AND of $(a_{\ell}, \ldots, a_{r}),ドル
  • the bitwise OR of $(b_{\ell}, \ldots, b_{r}),ドル and
  • the greatest common divisor of $(c_{\ell}, \ldots, c_{r})$.

There are $m$ queries. Each query provides an interval $[\ell, r],ドル and asks for the sum of the values of all intervals $[\ell', r']$ such that $\ell \le \ell' \le r' \le r$. As the answer may be large, find it modulo 2ドル^{32}$.

입력

The first line of input contains two integers $n$ and $m$ (1ドル \le n \le 10^6$; 1ドル \le m \le 5 \cdot 10^6$).

The second line contains $n$ integers $a_1, \ldots, a_n$.

The third line contains $n$ integers $b_1, \ldots, b_n$.

The fourth line contains $n$ integers $c_1, \ldots, c_n$.

The constraints are: 1ドル \le a_i, b_i, c_i \le n$.

Each of the following $m$ lines contains two integers $\ell$ and $r$ and represents a query (1ドル \le \ell \le r \le n$).

출력

Output $m$ lines, each containing one integer: the corresponding answer modulo 2ドル^{32}$.

제한

예제 입력 1

5 3
3 3 1 1 1
2 1 3 2 2
4 5 3 4 4
1 2
2 5
4 5

예제 출력 1

48
63
24

예제 입력 2

1 1
1
1
1
1 1

예제 출력 2

1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 3: THird roUnd H번

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

출처

대학교 대회

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

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