| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 0 | 0 | 0 | 0.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:
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}$.
5 3 3 3 1 1 1 2 1 3 2 2 4 5 3 4 4 1 2 2 5 4 5
48 63 24
1 1 1 1 1 1 1
1