← All problemsSign in

Permutation Counting (Easy)

CodeChefRating 2011Open on judge ↗

**This is the easy version of the problem. Here $K$ is fixed to be $3$.** You are given $2$ integers, $N$ and $K (K = 3)$. Count the number of permutations $P$ of the integers $[1, N]$ satisfying the following condition: - $(P_i + P_{i + 1}) \mod K \ne 0$ for all $1 \le i < N$ Since the answer may be large, output it modulo $998244353$. ### Input - The first line of input will contain a singl

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start