#P10102. [GDKOI2023 提高组] 矩阵
[GDKOI2023 提高组] 矩阵
Problem Description
You are given three matrices , , and multiple times. You need to determine whether is equal to modulo .
Here, denotes matrix multiplication, and .
The input size of this problem is large, so fast input reading is recommended.
Input Format
The first line contains a positive integer , the number of test cases.
Then there are test cases. In each test case, the first line contains a positive integer , the matrix size.
The next lines each contain integers, describing matrix .
The next lines each contain integers, describing matrix .
The next lines each contain integers, describing matrix .
Output Format
Output lines, each being Yes or No, indicating whether is equal to modulo .
3
1
2
3
6
2
1 2
3 4
5 6
7 8
19 22
43 51
2
1111111 2222222
3333333 4444444
5555555 6666666
7777777 8888888
39625305 256038638
772687616 944903942
Yes
No
Yes
Hint
For of the testdata, .
For another of the testdata, the number of positions where does not exceed .
For of the testdata, , , and .
Translated by ChatGPT 5