Sereja and D
Sereja has an array consisting of $n$ integers $a_{1} \leq a_{2} \leq \ldots \leq a_{n}$. Based on this array, he has to answer $m$ queries represented by pairs integers $t$ and $d$. The answer for a query is the smallest integer $i$ for which there exist some $k$ ($i \leq k$) such that $a_{i} + d \geq a_{i + 1}$, $a_{i + 1} + d \geq a_{i + 2}$, $\ldots$, $a_{k - 1} + d \geq a_{k}$,
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