#P8110. [Cnoi2021] 矩阵
[Cnoi2021] 矩阵
Description
Given two sequences of length , and , and an integer .
Let matrix satisfy . Find the sum of all elements in modulo .
Input Format
The first line contains two integers and .
The second line contains integers separated by spaces, representing .
The third line contains integers separated by spaces, representing .
Output Format
One line containing one integer, representing the sum of all elements in modulo .
3 0
1 2 3
4 5 6
3
3 3
1 2 3
4 5 6
92160
Hint
Constraints
For of the testdata, it is guaranteed that , , and .
Subtasks
Subtask 1 (10 points): .
Subtask 2 (20 points): .
Subtask 3 (20 points): .
Subtask 4 (50 points): no special constraints.
Notes
For the definition of matrix multiplication, refer to the Baidu Baike page.
In this problem, denotes the identity matrix.
Translated by ChatGPT 5
京公网安备 11011102002149号