Submission #3615794


Source Code Expand

N, x = map(int, input().split())
A = list(map(int, input().split()))
n_eat = 0

if A[0] > x:
    n_eat += A[0]
    A[0] = x

for i in range(N-1):
    if A[i] + A[i+1] > x:
        dif = A[i] + A[i+1] - x
        A[i+1] -= min(dif, A[i+1])
        n_eat += dif

print(n_eat)

Submission Info

Submission Time
Task C - Boxes and Candies
User taq225
Language Python (3.4.3)
Score 0
Code Size 287 Byte
Status WA
Exec Time 142 ms
Memory 14132 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 14
WA × 6
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 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
Case Name Status Exec Time Memory
0_00.txt AC 17 ms 3064 KB
0_01.txt AC 17 ms 3060 KB
0_02.txt AC 17 ms 3064 KB
0_03.txt AC 17 ms 3060 KB
1_00.txt AC 17 ms 3060 KB
1_01.txt AC 17 ms 3064 KB
1_02.txt AC 17 ms 3064 KB
1_03.txt AC 17 ms 3060 KB
1_04.txt AC 50 ms 4660 KB
1_05.txt AC 50 ms 4896 KB
1_06.txt AC 128 ms 14028 KB
1_07.txt AC 96 ms 14024 KB
1_08.txt WA 125 ms 13880 KB
1_09.txt WA 122 ms 14132 KB
1_10.txt AC 131 ms 13900 KB
1_11.txt AC 95 ms 14012 KB
1_12.txt WA 126 ms 13812 KB
1_13.txt WA 131 ms 13956 KB
1_14.txt WA 138 ms 14052 KB
1_15.txt WA 142 ms 13968 KB