Submission #4611308
Source Code Expand
import sys sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return input() def main(): N, x = LI() A = [0] + LI() ans = 0 for i in range(1, N + 1): red = A[i] + A[i - 1] - x if red > 0: ans += red A[i] -= red return ans print(main())
Submission Info
Submission Time | |
---|---|
Task | C - Boxes and Candies |
User | hitstales |
Language | Python (3.4.3) |
Score | 300 |
Code Size | 630 Byte |
Status | AC |
Exec Time | 73 ms |
Memory | 14620 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 16 ms | 3064 KB |
0_01.txt | AC | 17 ms | 3064 KB |
0_02.txt | AC | 17 ms | 3064 KB |
0_03.txt | AC | 17 ms | 3064 KB |
1_00.txt | AC | 17 ms | 3064 KB |
1_01.txt | AC | 17 ms | 3064 KB |
1_02.txt | AC | 17 ms | 3064 KB |
1_03.txt | AC | 17 ms | 3064 KB |
1_04.txt | AC | 48 ms | 4964 KB |
1_05.txt | AC | 49 ms | 4968 KB |
1_06.txt | AC | 71 ms | 14196 KB |
1_07.txt | AC | 66 ms | 14196 KB |
1_08.txt | AC | 69 ms | 14528 KB |
1_09.txt | AC | 69 ms | 14004 KB |
1_10.txt | AC | 69 ms | 13824 KB |
1_11.txt | AC | 65 ms | 13816 KB |
1_12.txt | AC | 69 ms | 13900 KB |
1_13.txt | AC | 72 ms | 14620 KB |
1_14.txt | AC | 73 ms | 14008 KB |
1_15.txt | AC | 71 ms | 14040 KB |