Colosseum
For a permutation$^\dagger$ $P$ of the integers $1$ to $N$, and a parameter $K$, we define its *winner*, denoted $\text{win}(P, K)$, as the result of the following process: - Let $x = 1$ initially. - For each index $i$ from $2$ to $N$, in order: - If $P_i + K \geq P_x$, set $x$ equal to $i$. $\text{win}(P, K)$ is then defined to be the final value of $x$, after the process ends. --- You're
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