#P3795. 钟氏映射

钟氏映射

Description

Let N=M={xxN+,xk,kN+}N = M = \left\{x|x\in N_+,x\leq k,k\in N_+\right\}. Let ff be a mapping from NN to MM. Count the number of distinct mappings ff that satisfy f(f(x))=xf(f(x)) = x. Since the answer may be large, output the result modulo 1423333314233333.

Input Format

A single positive integer kk.

Output Format

Output the number of distinct mappings ff satisfying f(f(x))=xf(f(x)) = x, modulo 1423333314233333.

3

4

Hint

For k=3k = 3, the four mappings are:

f(1) f(2) f(3)
1 2 3
3 2
2 1 3
3 2 1

Constraints:

  • For 20% of the testdata, 1k91 \leq k \leq 9.
  • For the other 80% of the testdata, 1k1071 \leq k \leq 10^7.

Memory 20 MB... (I initially set 1 MB and got myself into trouble).

Translated by ChatGPT 5