| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1344889 | maximilianuggla | Feast (NOI19_feast) | Pypy 3 | 179 ms | 211876 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:
if sum < 0:
intervalls.append(0)
else:
intervalls.append(sum)
sum = lowest
maxEnding = 0
if sum < 0:
intervalls.append(0)
else:
intervalls.append(sum)
intervalls.sort(reverse=True)
res = 0
for k in range(K):
res = res + intervalls[k]
return res
N, I = map(int, input().split())
numbers = list(map(int, input().split()))
print(maxOfKIntervalls(numbers, I))컴파일 시 표준 출력 (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... | ||||
