91802024-02-17 15:55:07FarkasZénóVásárlás (75 pont)pypy3Accepted 75/75108ms121472 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/041ms76220 KiB
2Accepted0/068ms96220 KiB
3Accepted3/339ms77228 KiB
4Accepted4/439ms77500 KiB
5Accepted4/439ms77284 KiB
6Accepted4/439ms77540 KiB
7Accepted4/445ms81296 KiB
8Accepted3/345ms81488 KiB
9Accepted4/452ms88444 KiB
10Accepted4/452ms88004 KiB
11Accepted4/463ms88400 KiB
12Accepted5/564ms88912 KiB
13Accepted3/3104ms116684 KiB
14Accepted3/393ms117032 KiB
15Accepted3/389ms117240 KiB
16Accepted3/3104ms117308 KiB
17Accepted3/3104ms121296 KiB
18Accepted3/3108ms121472 KiB
19Accepted3/390ms116528 KiB
20Accepted3/3100ms117284 KiB
21Accepted3/393ms117300 KiB
22Accepted3/3101ms118244 KiB
23Accepted3/3101ms117932 KiB
24Accepted3/390ms119008 KiB