← All problemsSign in

Tuple Slimes

CodeChefRating 2654Open on judge ↗

There are $N$ slimes arranged in a line, and the attribute of the $i$-th slime can be represented by a tuple $(A_i, B_i)$. You need to perform the following operations exactly $N-1$ times. At the $K$-th $(1 \le K \le N-1)$ operation: - Choose two adjacent indices $i$, $j$ ($1 \leq i, j \leq N-K+1$, $|i - j| = 1$), and let the $i$-th slime eat the $j$-th slime. - After this operation, the attribu

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