So I have been trying to crack problem F on the Tinkoff challenge final round for like the whole day now, but I'm still getting runtime error on test 8. My solution is the exact same algorithm as the editorial, and almost the exact same code. I have been debugging for 3 hours with no use.
http://codeforces.me/contest/794/submission/27098860
If you could help, it would be greatly appreciated.
Auto comment: topic has been updated by farmersrice (previous revision, new revision, compare).
http://codeforces.me/contest/794/submission/27100893
Your submission with 1 change got AC.
I leave it to you to figure out the change.
Oh, I cannot believe I didn't see that! Thanks!