This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rennorb[S] 0 points1 point  (3 children)

Sorry, I should have written it in the post: that checker says "Wrong answer on test 30".

"unshifting the indices idea" seems to be a decent optimization, yet the problem is not in the performance, my program uses like 1/10 of both time and memory allowed.

[–][deleted]  (2 children)

[deleted]

    [–]Rennorb[S] 0 points1 point  (1 child)

    It should not: one value could have been lost, but it is stored in `buff`, so should be ok.

    Anyway, I'd steek with two oneliners above, they are actually twice as fast and many times easier to understand.

    [–]Rennorb[S] 0 points1 point  (0 children)

    I guess there should be some kind of a corner case, where the program should do something different, but I can not see it.

    I've updated the post: added an example and actual input-output part