During the discussion after the Round 421 it turned out that the author's solution was wrong. Yes, we had several testers, we had a bruteforce solution that worked correctly, we had a stress testing between the bruteforce and the main solutions. However, all these measures haven't prevented the mistake: the testers haven't noted the issue, the stress haven't found any counter-tests. The solutions also produced the same answers all small tests we had in the testset, so we only found the issue when a test used for a hack was added.
We are terribly sorry about the mistake. We did our best to ensure the problems are ok, I don't know any available method that we haven't used to check the problem.
We've spent the last few hours trying to come up with a new, correct solution to the problem, but right now I don't see any solution that seems undoubtedly correct to me. There are a few that work better than the author's, but yet unproved, you can try to prove this one, for example. I think this problem should be solvable with careful case analysis, and I'm trying to do this right now. I'll post the results here. I'd also be glad if someone post the solution with proof.
Thus, I apologize that the round should be declared unrated. Hope for your understanding.