| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1344884 | maximilianuggla | Feast (NOI19_feast) | Pypy 3 | 177 ms | 212120 KiB |
def maxOfKIntervalls(nums, K: int) -> int:
lowest = -10**10
intervalls = []
maxEnding = 0
sum = lowest
for e in nums:
maxEnding = maxEnding + e
if maxEnding > sum:
sum = maxEnding
if maxEnding < 0:
intervalls.append(sum)
sum = lowest
maxEnding = 0
intervalls.append(sum)
intervalls.sort(reverse=True)
res = 0
for k in range(K):
res = res + intervalls[k]
if res < 0:
return 0
else:
return res
N, I = map(int, input().split())
numbers = list(map(int, input().split()))
print(maxOfKIntervalls(numbers, I))Compilation message (stdout)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
