Permutation Pair
You're given two integers $N$ and $K$. Count the number of permutations$^\dagger$ $P$ of the integers $1$ to $N$ satisfy the following condition: - There exists **at least one** index $i$ $(1 \leq i \lt N$) such that $P_i + P_{i+1} = K$. Since the count can be very large, print it modulo $10^9+7$. $^\dagger$ A permutation of the integers $1$ to $N$ is an array of length $N$ that contains every i
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