I was in the process of upsolving [Codeforces Round 707](https://mirror.codeforces.com/contest/1500). I'm not quite sure how to do 1C, and the editorial seems a bit difficult to understand.↵
↵
↵
↵
It seems like I'm not the only one who is having difficulty understanding the editorial 1C. Thanks to [user:mshiladityam,2021-03-15] for posting a comment asking about why the $O(nm^2)$ solution works [(here)](https://mirror.codeforces.com/blog/entry/88591?#comment-770362), which received 16 upvotes (many of whom I'm presuming also are unsure about that portion of the editorial). ↵
↵
I'm afraid there is not any clear solution that anyone has access to (one can only read accepted codes and watch ecnerwala's stream. On another note, I thank [user:NiceClock,2021-03-15] for sending a link to code though, which seems rather elegant [(here)](https://mirror.codeforces.com/blog/entry/88591?#comment-770598)). I would like there to be a clear explanation to on how to solve the problem though.↵
↵
↵
Most of the comments in the editorial blog post are about Div2 A — D, and I am thus creating a separate blog post for us to have a clutter-free area to discuss this problem. I personally feel that this seems like an interesting problem, and many people will hopefully be benefited by having a place to discuss the solution to it.
↵
↵
↵
It seems like I'm not the only one who is having difficulty understanding the editorial 1C. Thanks to [user:mshiladityam,2021-03-15] for posting a comment asking about why the $O(nm^2)$ solution works [(here)](https://mirror.codeforces.com/blog/entry/88591?#comment-770362), which received 16 upvotes (many of whom I'm presuming also are unsure about that portion of the editorial). ↵
↵
I'm afraid there is not any clear solution that anyone has access to (one can only read accepted codes and watch ecnerwala's stream. On another note, I thank [user:NiceClock,2021-03-15] for sending a link to code though, which seems rather elegant [(here)](https://mirror.codeforces.com/blog/entry/88591?#comment-770598)). I would like there to be a clear explanation to on how to solve the problem though.↵
↵
↵
Most of the comments in the editorial blog post are about Div2 A — D, and I am thus creating a separate blog post for us to have a clutter-free area to discuss this problem. I personally feel that this seems like an interesting problem, and many people will hopefully be benefited by having a place to discuss the solution to it.