#P15864. [LBA-OI R3 D] 阵列之弈
[LBA-OI R3 D] 阵列之弈
Description
We are given a basketball court with horizontal division lines and vertical division lines, dividing the court into an grid of regions.
The coach assigns a unique formation number (from to ) to each region, forming a formation matrix.
The formation diversity value of a matrix is defined as the number of distinct values of the minimum missing formation number across all submatrices of the matrix.
::::info[Example]{open} If the formation numbers in a submatrix are , the minimum missing number is . If the formation numbers in a submatrix are , the minimum missing number is . ::::
Find the sum of the formation diversity values over all possible formation matrices. Since the answer can be large, output it modulo .
Formal Statement
Given . An matrix is valid if it is a permutation of integers from to . Define of a matrix as the size of the set containing the of all its submatrices. Compute the sum of over all valid matrices, modulo .
::::success[Definition of Submatrix] A submatrix is formed by deleting a prefix of rows/columns and a suffix of rows/columns from the original matrix. ::::
Input Format
One line with two integers .
Output Format
One integer representing the answer modulo .
1 2
6
1 20
704442100
10 10
506259194
Hint
Explanation of Sample 1
There are two valid matrices:
0 11 0
For 0 1, the submatrices are 0 (mex = ), 1 (mex = ), 0 1 (mex = ). The set is , so .
The case 1 0 is symmetric.
Total answer: .
Data Constraints
| Subtask | Special Property | Score | |
|---|---|---|---|
| A | |||
| B | |||
| C | |||
| D | |||
| None | |||
Special Property A: . Special Property B: . Special Property C: . Special Property D: .
For data: . Please pay attention to the constant complexity of your implementation.
京公网安备 11011102002149号