#P17341. 【MX-X30-T7】言而无信者的救赎
【MX-X30-T7】言而无信者的救赎
Background
Even if I myself will be drowned in
endless sorrow,
I will still return to blankness,
to a blank future.
Problem Description
For a permutation of length , define as the number of integer pairs that satisfy the following conditions:
- .
- .
- .
Define as the number of permutation cycles of .
For and , please compute the number of permutations such that and , taken modulo , denoted as .
Please compute $\displaystyle \bigoplus_{i=0}^n \bigoplus_{j=1}^{2n} \left(d + H(i, j)\right)$.
Input Format
This problem contains multiple test cases.
The first line contains an integer .
The next lines each contain two integers .
Output Format
Output lines in total. For each test case, output one integer per line, representing $\displaystyle \bigoplus_{i=0}^n \bigoplus_{j=1}^{2n} \left(d + H(i, j)\right)$.
3
2 0
10 0
100 0
10
836833797
850061004
3
1000 1
2000 2
4000 45
300382194
871761782
343429692
Hint
For all data, it is guaranteed that , , and .
::cute-table{tuack}
| Subtask ID | Score | |
|---|---|---|
Translated by ChatGPT 5