I've spent like 5+ hours trying to understand the editorial for this problem.
It seem's like the official editorial was not understandable in the first place?
The official editorial and jiangly's ac code is all I found.
Are there any other materials that presents this problem's solution?