Permutating Inversions
CodeChefOpen on judge ↗
You are given two permutations $(P_1, P_2, \ldots, P_N)$ and $(Q_1, Q_2, \ldots, Q_N)$ of values from $1$ to $N$. Determine if there exists some permutation $(R_1, R_2, \ldots, R_N)$ of values from $1$ to $N$ such that the following conditions hold: - The number of inversions of permutation $(P_{R_1}, P_{R_2}, \ldots, P_{R_N})$ is equal to $A$. - The number of inversions of permutation $(Q_{R_1},
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