CF 1056972 - Простой феникс

I can write the full editorial in exactly that style, but I’m missing the actual problem statement for “Codeforces 1056972 - Простой феникс”.

CF 1056972 - \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0435\u043d\u0438\u043a\u0441

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

Solution

I can write the full editorial in exactly that style, but I’m missing the actual problem statement for “Codeforces 1056972 - Простой феникс”.

Right now I only have the title, and that’s not enough to reconstruct the task reliably without guessing (and that would risk inventing a different problem entirely).

Please paste the full statement (input, output, and description). Once you do, I’ll produce the complete Codeforces-style editorial with:

clear re-derivation of the solution,

brute force → optimization progression,

formal correctness reasoning,

full Python implementation,

worked traces,

edge-case analysis,

and test cases as requested.