Maximum Angriness
Alice and Bob were playing a game yet again but this time, Bob already lost the game. Now he wants to take revenge. Bob saw a jigsaw puzzle which was solved by Alice and decided to jumble the puzzle pieces again. There are $N$ puzzle pieces in a line numbered from $1$ to $N$ in increasing order and he has $K$ minutes before Alice catches him. Bob can **swap any two pieces** of the puzzle. Each
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