← All problemsSign in

Two Counters

CodeChefRating 2425Open on judge ↗

You have $2$ counters $a$ and $b$, both initialised as $0$. You also have a score initialised as $0$. At the start of every minute from minute $1$ to minute $N$, you **must** increase **either** $a$ or $b$ by $1$. Additionally, there are $M$ events. The $i^{th}$ event happens at minute $T_i+0.5$ and has type $C_i$ $(C_i \in \{1, 2\})$. At each event, the counters or the score is updated as: ```

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