ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1296. Hyperjump

gippotalamus Please ! Need help..my algoritm is wright, but ! WA9 [4] // Problem 1296. Hyperjump 15 Nov 2005 23:17
>
>
i found my mistake

Edited by author 20.11.2005 00:44
I have wa#9 but I can't found mistake :(

what is  test 9?
3
-1
-1
1
try this
I tried this and I get the correct answer, but test 9 code fails.
Here is the code that fails test 9:

from typing import List

potentials: List[int] = []
N: int = int(input())

for p in range(N):
    potentials.append(int(input()))


def list_max_right_sum(lst: List[int]) -> List[int]:
    amount: int = 0
    left_min: int = 0
    left_max_index: int = 0
    k: int = 0
    for i, p in enumerate(lst):
        amount += p
        k = i + 1
        if amount < left_min:
            left_min = amount
            left_max_index = i + 1
    return lst[left_max_index: k]


result: List[int] = list_max_right_sum(potentials)
result.reverse()
result = list_max_right_sum(result)
print(sum(result))