Here's my submission 166077380. For some reason, it fails on test 2, testcase 13 however, I'm not able to view it (which is probably intended). I tried checking the editorial and their code Editorial is quite similar to mine. I also cannot find any other solution from other submissions that fail at test 2, testcase 13. Can anyone provide some help?
You made a one simple mistake in the beginning. For some reason, you checked the
sum
to be dividable byn
, not byn * (n + 1) / 2
. Also, thelast[id] <= 1e9
if is not necessary here :)166110615
Thank you so much!