As mentioned in another thread, this probably isn't solvable in Python with the current judge setup. The interpreter seems to eat too much memory.*
I'm fairly sure your algorithm is fine, though.
*If I'm incorrect on this point I'm sure someone will correct me.

As mentioned in another thread, this probably isn't solvable in Python with the current judge setup. The interpreter seems to eat too much memory.*

Your Python solution on the Best Solutions page is already very close to the memory limit. The judge has probably changed since almost a year ago. There's also the chance that the memory limiter is broken.

Your Python solution on the Best Solutions page is already very close to the memory limit. The judge has probably changed since almost a year ago. There's also the chance that the memory limiter is broken.

Read the problem statement carefully. The diagram at the top is the real representation of the triangle. [quote]Each step can go either diagonally down to the left or diagonally down to the right.[/quote] According to that, you cannot move from the 8 in row 2 to the 8 in row 3 (the only valid moves from the 8 in row 2 is to the 1 or 0 in row 3). Don't be tricked by the input format, which is simply the triangle without the formatting.

Read the problem statement carefully. The diagram at the top is the real representation of the triangle.

Each step can go either diagonally down to the left or diagonally down to the right.

According to that, you cannot move from the 8 in row 2 to the 8 in row 3 (the only valid moves from the 8 in row 2 is to the 1 or 0 in row 3). Don't be tricked by the input format, which is simply the triangle without the formatting.