#P4484. [BJWC2018] 最长上升子序列
[BJWC2018] 最长上升子序列
Description
Given a uniformly random permutation of length , compute the expected length of its longest increasing subsequence.
To avoid precision errors, you only need to output the answer modulo .
Input Format
The input contains a single positive integer .
Output Format
Output a single non-negative integer, the remainder of the answer modulo .
It can be proved that the answer is a rational number; let it be ( are coprime integers). Let the integer you output be . You must ensure and .
1
1
2
499122178
3
2
Hint
Sample #2 Explanation:
This is .
Constraints:
- For of the data, .
- There are 25 testcases. For the -th testcase (), .
Translated by ChatGPT 5
京公网安备 11011102002149号