Submission #1072544


Source Code Expand

Copy
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
ans = 0
for i in range(N):
	if A[i] > 0:
		ans += A[i]
		A[i] = 0
m = sum(A[:K])
for i in range(N-K):
	M = m - A[i] + A[i+K]
	m = max(M,m)
print(max(ans+m,0))

Submission Info

Submission Time
Task B - Contiguous Repainting
User TAB
Language Python3 (3.4.3)
Score 0
Code Size 240 Byte
Status
Exec Time 131 ms
Memory 14600 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 0 / 400 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt
Case Name Status Exec Time Memory
0_00.txt 22 ms 3064 KB
0_01.txt 22 ms 3064 KB
0_02.txt 22 ms 3064 KB
0_03.txt 22 ms 3064 KB
1_00.txt 22 ms 3064 KB
1_01.txt 22 ms 3064 KB
1_02.txt 22 ms 3064 KB
1_03.txt 95 ms 4908 KB
1_04.txt 131 ms 14152 KB
1_05.txt 119 ms 14124 KB
1_06.txt 129 ms 14236 KB
1_07.txt 128 ms 13916 KB
1_08.txt 74 ms 13916 KB
1_09.txt 82 ms 14132 KB
1_10.txt 83 ms 14048 KB
1_11.txt 96 ms 14004 KB
1_12.txt 84 ms 13948 KB
1_13.txt 100 ms 14004 KB
1_14.txt 88 ms 13952 KB
1_15.txt 99 ms 14020 KB
1_16.txt 113 ms 14128 KB
1_17.txt 124 ms 14096 KB
1_18.txt 93 ms 14212 KB
1_19.txt 96 ms 14600 KB
1_20.txt 95 ms 13880 KB
1_21.txt 89 ms 14348 KB