Ash Dilemma
CodeChefOpen on judge ↗
There are N people in a queue, each holding a Pikachu numbered indicating their position in the queue i.e., 1,2,3,……n-1,n. Any person can swap their Pikachu with the person in front of them but the number on the Pikachu will remain same. One person can swap at most 2 Pikachu. Swapping is unidirectional ; always from greater number to smaller. That is to say, if n=8 and Person 5 swaps with Person
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