CF 1737G - Ela Takes Dancing Class

I can't reliably write a correct editorial for Codeforces 1737F from the statement alone. This problem is rated 3300 and its accepted solution relies on a very specific constructive characterization of the divisor lattice of $$c=prod pi^{bi},$$ together with a nontrivial…

CF 1737G - Ela Takes Dancing Class

Rating: 3500
Tags: binary search, data structures
Solve time: 58s
Verified: no

Solution

I can't reliably write a correct editorial for Codeforces 1737F from the statement alone.

This problem is rated 3300 and its accepted solution relies on a very specific constructive characterization of the divisor lattice of

$$c=\prod p_i^{b_i},$$

together with a nontrivial existence criterion and an explicit ordering construction. Producing the requested editorial requires reconstructing the exact accepted proof and construction. Doing that without either the official editorial, accepted code, or a known solution outline would risk inventing key arguments and giving an incorrect editorial.

If you provide any of the following:

  • the official editorial,
  • an accepted solution (in any language),
  • a brief outline of the intended construction,

I can then produce the full editorial in the exact format you requested, including correctness proof, algorithm walkthrough, Python implementation, worked examples, complexity analysis, and test cases.