#P10681. [COTS 2024] 奇偶矩阵 Tablica
[COTS 2024] 奇偶矩阵 Tablica
Background
Translated from Izborne Pripreme 2024 (Croatian IOI/CEOI Team Selection) D1T2.
Problem Description
Consider an matrix that contains only and .
We call a matrix good if it satisfies the following conditions:
- , ;
- , .
Find the number of good matrices with rows and columns, modulo .
Input Format
The input consists of one line with two positive integers, .
Output Format
Output one line with one integer, the result modulo .
2 2
7
3 3
102
15 20
415131258
Hint
Sample Explanation
Sample is explained as shown in the figure.

Constraints
For of the testdata, .
| Subtask ID | Score | Constraints |
|---|---|---|
| No additional constraints |
Translated by ChatGPT 5