atcoder#ARC145C. [ARC145C] Split and Maximize

[ARC145C] Split and Maximize

Score : 600600 points

Problem Statement

The score of a permutation P=(P1,P2,,P2N)P=(P_1,P_2,\ldots,P_{2N}) of (1,2,,2N)(1,2,\ldots,2N) is defined as follows:

$$P$$$$A = (A_1,A_2,\ldots,A_N)$$$$B = (B_1,B_2,\ldots,B_N)$$$$P$$$$\displaystyle\sum_{i=1}^{N}A_i B_i$$Let $M$ be the maximum among the scores of all permutations of $(1,2,\ldots,2N)$. Find the number, modulo $998244353$, of permutations of $(1,2,\ldots,2N)$ with the score of $M$. $$

Constraints

  • 1N2×1051 \leq N \leq 2\times 10^5
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer.

2
16

The maximum among the scores of the 2424 possible permutations, MM, is 1414, and there are 1616 permutations with the score of 1414.

For instance, the permutation (1,2,3,4)(1,2,3,4) achieves i=1NAiBi=14\sum _{i=1}^{N}A_i B_i = 14 in the division A=(1,3),B=(2,4)A=(1,3), B=(2,4).

10000
391163238

Print the count modulo 998244353998244353.