Roller Coaster - I am getting wrong result for last test case

Hi, I have problem to pass the last test (06). The answer I got is 89738136800958, and I checked my algorithm and I could not find anything wrong.

Has anyone passed this problem? Or is anyone getting the same result?


Hi, i found 89744892565569. and it’s works :stuck_out_tongue:

Thank you. I just passed it. I found a bug in my counting logic.

My code passes all the tests except the last one (it’s too slow). It’s in Python.
I shaved every slow methods and redundancies but no way.
Did someone solve it with Python?

Nope, Java and Clojure only

I use Python and it runs very fast. The pure simulation won’t pass. You need to compose a new list by compressing the status.

I don’t change the list, I just read it.
I thought about pre-calculing the partial sums but here it will be too long.
OK, got it.