On CHEFPART during today’s lunchtime, the only person to get AC was tourist (gennady.korotkevich).
I believe this wasn’t because he was the only one to get the right answer though. It was because he was the only one to mess up in the same way as the judges.
First of all, what should the answer be if n=1. In this case, it is impossible to separate into two non-empty sequences, so every sequence is good, meaning chef does not have to do any swaps. The answer should be 0.
In cases where n=1, and a_0 is a power of 2, gennady.korotkevich’s code outputs -1.
Furthermore, I added a line to abort() if this output ever comes up and resubmitted, and got a run time error. That means that tourist’s code actually should have gotten WA.
Am I misunderstanding the problem here? I spent a while on this problem and gave up after failing to get AC.