← All problemsSign in

Double Trouble

CodeChefRating 1853Open on judge ↗

Alice has $N$ magical balls placed on the $x$-axis. The $i$-th ball is initially at position $X_i$ and has a power of $P_i$. It is guaranteed that $X_i \lt X_{i+1}$ for $1 \leq i \lt N$. Initially, none of the balls are activated. Alice can do the following **at most twice**: - Choose an index $i$ ($1 \leq i \leq N$) such that ball $i$ is *not* activated. - Activate ball $i$, and choose a dire

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