#P8474. 「GLR-R3」立春
「GLR-R3」立春
Description
Since Tianyi has just woken up and is afraid the statement of the first problem will make everyone confused, this problem only provides a brief description. (Actually, I really cannot make up more story.)
Let be any permutation of length , and let denote the number of inversion pairs in it. Compute
modulo .
Input Format
Input one integer in a single line, denoting the length of the permutation.
Output Format
Output one integer in a single line, denoting the required answer.
3
21
Hint
Explanation of the statement
This section introduces the definition of inversion pairs for some contestants. If you are familiar with it, you may skip this section.
For a permutation of length , assuming indices start from , we say forms an inversion pair if and only if and . denotes how many different pairs satisfy the condition above.
For example, for the permutation , the inversion pairs are , so . It can be seen that as long as the relative order of the elements in is fixed, is fixed.
Sample #1 Explanation
$$\begin{aligned} \sum_{\sigma}2^{\tau(\sigma)} &= 2^{\tau(\lang 1,2,3\rang)}+2^{\tau(\lang 1,3,2\rang)}+2^{\tau(\lang 2,1,3\rang)}+2^{\tau(\lang 2,3,1\rang)}+2^{\tau(\lang 3,1,2\rang)}+2^{\tau(\lang 3,2,1\rang)}\\ &= 2^0+2^1+2^1+2^2+2^2+2^3\\ &= 21. \end{aligned}$$Constraints and Notes
This problem uses Subtask-based scoring.
| Subtask ID | Score | |
|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号