FIXFIX
Given a positive integer $n$ and an integer $k$ such that $0 \leq k \leq n$, find any permutation $A$ of $1, 2 \dots n$ such that the number of indices for which $A_i=i$ is exactly $k$. If there exists no such permutation, print $-1$. If there exist multiple such permutations, print any one of them. ### Input - First line of the input contains $T$, the number of test cases. Then the test cases fo
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