Nam Hyeon-uk
Time limit2sMemory limit1024 MB
Given n and m (0 to 3), sum the inversion counts of all length-n permutations with exactly m increasing subsequences of length 3, mod 998244353.
- Level
Hard8 of 10
- Topics
- Combinatorics, Math, Dynamic programming
- Solved
- No attempts yet
Problem
Nam Hyeon-uk could not solve this problem.
Among all permutations of length , count those with exactly increasing subsequences (increasing subsequence) of length 3, and print the count modulo 998,244,353.
But Nam Hyeon-uk could not solve this problem.
So instead of counting the sequences, he wants to compute the sum of the inversion counts (inversion) of those sequences.
Print the answer to the problem Nam Hyeon-uk changed, modulo 998,244,353.
Input
The first line contains two integers and . (, )
Output
Print the answer on the first line.