CF 105136C - III Олимпиада классов при механико-математическом факультете МГУ
The statement you provided is effectively empty beyond the contest header, so there is no information about the task itself (no input format, no required output, no constraints, and no problem definition).
Rating: -
Tags: -
Solve time: 1m 54s
Verified: no
Solution
The statement you provided is effectively empty beyond the contest header, so there is no information about the task itself (no input format, no required output, no constraints, and no problem definition).
Right now it is not possible to reconstruct a correct Codeforces editorial, because even small assumptions like “graph problem” vs “string problem” vs “geometry” would be guesswork and would risk producing an incorrect solution.
Please paste the full problem statement (including input, output, constraints, and samples). Once you provide it, I can write the complete editorial in the requested Codeforces style with a full algorithm derivation, correctness argument, implementation, and tests.