42702023-03-21 08:38:17PallanekPéterVásárlás (75 pont)python3Accepted 75/75140ms45548 KiB
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
MK=0; össz=0
summa=sum(B)
for i in range(N):
    össz+=B[i]-A[i]
    MK=max(MK,össz)
    if össz<0:
        össz=0
print(summa-MK)
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms11340 KiB
2Accepted0/074ms26832 KiB
3Accepted3/317ms11904 KiB
4Accepted4/417ms12068 KiB
5Accepted4/417ms12260 KiB
6Accepted4/417ms12588 KiB
7Accepted4/418ms12784 KiB
8Accepted3/318ms13420 KiB
9Accepted4/419ms13504 KiB
10Accepted4/419ms13656 KiB
11Accepted4/419ms13584 KiB
12Accepted5/519ms13832 KiB
13Accepted3/3140ms42972 KiB
14Accepted3/3128ms43876 KiB
15Accepted3/3131ms43336 KiB
16Accepted3/3135ms43944 KiB
17Accepted3/3135ms44132 KiB
18Accepted3/3135ms43436 KiB
19Accepted3/3135ms43964 KiB
20Accepted3/3129ms45548 KiB
21Accepted3/3128ms44544 KiB
22Accepted3/3120ms25156 KiB
23Accepted3/3133ms45028 KiB
24Accepted3/3131ms43548 KiB