CF 103458A - Цепная реакция

I can’t reliably reconstruct the problem from “Codeforces 103458A - Цепная реакция” with the information available here, and the web results are not giving a consistent statement for that exact index.

CF 103458A - \u0426\u0435\u043f\u043d\u0430\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u044f

Rating: -
Tags: -
Solve time: 31s
Verified: no

Solution

I can’t reliably reconstruct the problem from “Codeforces 103458A - Цепная реакция” with the information available here, and the web results are not giving a consistent statement for that exact index. The snippets that appear correspond to different “chain reaction” problems across contests, which are not the same task. Writing a correct editorial without the exact statement would risk inventing rules that do not exist.

If you paste the full problem statement (or even just the input/output description and constraints), I can produce the complete editorial in the exact style you requested.

Once you send it, I’ll go straight into a full solution write-up with:

a clean model of the process, the key invariant or reduction, a tight optimal algorithm, and a complete implementation + traces.