91792024-02-17 15:53:52FarkasZénóVásárlás (75 pont)python3Accepted 75/75171ms44076 KiB
from sys import stdin

N = int(stdin.readline())

A = [int(x) for x in stdin.readline().split()]
B = [int(x) for x in stdin.readline().split()]
A_B = [A[i]-B[i] for i in range(N)]
min_most = 0
min_teljes = float('inf')
for x in A_B:
	min_most = min(x, min_most+x)
	min_teljes = min(min_most, min_teljes)
min_teljes = min(0, min_teljes)
print(min_teljes+sum(B))
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms11280 KiB
2Accepted0/090ms28224 KiB
3Accepted3/318ms12472 KiB
4Accepted4/417ms12772 KiB
5Accepted4/417ms12584 KiB
6Accepted4/417ms13008 KiB
7Accepted4/418ms13344 KiB
8Accepted3/318ms13212 KiB
9Accepted4/419ms13656 KiB
10Accepted4/419ms14096 KiB
11Accepted4/419ms14136 KiB
12Accepted5/519ms13804 KiB
13Accepted3/3164ms42476 KiB
14Accepted3/3159ms43288 KiB
15Accepted3/3164ms43592 KiB
16Accepted3/3165ms43616 KiB
17Accepted3/3158ms43544 KiB
18Accepted3/3164ms43728 KiB
19Accepted3/3167ms44016 KiB
20Accepted3/3159ms43852 KiB
21Accepted3/3162ms43668 KiB
22Accepted3/3152ms24620 KiB
23Accepted3/3171ms44076 KiB
24Accepted3/3165ms42720 KiB