Finally, Non Ad-Hoc Problem
CodeChefOpen on judge ↗
You are given two integers $A$ and $N$. Calculate number of permutations $p$ of length $N$ such that $i - N + A < p_i < i + A$ for $1 \le i \le N$. Since this number can be very large, calculate it modulo $998244353$. ### Input The only line of the input contains two integers $N$, $A$. ### Output Output the number of permutations modulo $998244353$. ### Constraints - $2 \le N \le 10^9$ - $1 \l
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start