|
|
back to board> > 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)) |
|
|