User editorial for Codeforces Round 513 by Barcelona Bootcamp (rated, Div. 1 + Div. 2)
It’s been about 5 years since the round took place, and since there was no editorial all this time, I decided to write one myself. Thanks to tfg for discussing problem F with me and coming up with the permutation interpretation that makes it much easier to reason about the problem. The idea in F was also inspired by other submissions. 1060A Hints/intuition Think about two cases: when there are very few 8s, and when there are a lot of 8s. ...