#P7245. 灯光效果
灯光效果
Description
For stage effects, lighting is an important role. The background screen is an rectangle. Rows are numbered from left to right and columns are numbered from top to bottom as . A lighting cell at row and column is denoted by .
As the dedicated lighting designer, A-Ling wrote a program to control the background lighting effects. She sets two increasing integer sequences and of length , satisfying and . Each time the lights change, the program uniformly randomly generates two pairs of integers and , satisfying and , and toggles (on becomes off, off becomes on) the state of all lighting cells that satisfy and .
At the beginning of the performance, all lighting cells are off. After calculation, there will be a total of lighting changes by the end of the performance. Since the lighting effect at the curtain call is crucial, A-Ling wants to know: at the end, what is the expected number of lighting cells that are on?
Since the answer may be a decimal, to avoid precision loss, output the value of the answer modulo .
Simplified Statement
There is an matrix, with all elements initially equal to . Given increasing sequences and , where and , one operation is defined as:
- Randomly choose four integers satisfying and .
- XOR every element in the submatrix with top-left corner and bottom-right corner by .
Find the expected value of the sum of all elements in the matrix after operations. Take the answer modulo .
Input Format
The first line contains three integers .
The second line contains integers, where the -th number denotes .
The third line contains integers, where the -th number denotes .
Output Format
Output one integer in one line, representing the value of the answer modulo .
2 3 1
0 1 2
0 1 2
110916041
3 3 3
0 1 2
0 1 2
592921545
Hint
Sample Explanation 1
In the sample, . You can see that any submatrix of this matrix can be toggled. When the submatrix sizes are , the numbers of corresponding choices are . Since there is only one operation, the corresponding final sums of matrix elements are . Therefore, the answer is .
Constraints
This problem uses bundled testdata.
For of the data, , , . It is guaranteed that are pairwise distinct and strictly increasing, and are pairwise distinct and strictly increasing.
| Subtask | Score | |||
|---|---|---|---|---|
| 1 | 10 | |||
| 2 | 5 | / | / | |
| 3 | 25 | / | ||
| 4 | 20 | |||
| 5 | ||||
| 6 | / | / |
Translated by ChatGPT 5
京公网安备 11011102002149号