← All problemsSign in

Triple Sort

CodeChefRating 2012Open on judge ↗

You are given a permutation $p_1, p_2, \ldots, p_N$ of the integers $1$ through $N$. You may perform up to $K$ operations of the following type: - Choose three pairwise distinct valid indices $i_1, i_2, i_3$. Note that these indices do not have to be chosen in increasing order. - Let's denote the values of $p_{i_1}$, $p_{i_2}$ and $p_{i_3}$ before this operation by $v_1$, $v_2$ and $v_3$ respect

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