#P5784. [CQOI2008] 矩阵的个数
[CQOI2008] 矩阵的个数
Description
Given the sums of each row and each column of an non-negative integer matrix, count how many matrices satisfy these conditions. Output the answer modulo .
Input Format
The first line contains four positive integers , , , , representing the number of rows and the sums of the three columns. The second line contains positive integers, representing the sum of the three numbers in each row. The sum of each row and each column does not exceed .
Output Format
Output one number: the number of matrices satisfying the conditions modulo .
3 2 3 4
1 2 6
17
Hint
| Test Point ID | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号