90062024-02-11 17:10:27FarkasZénóVásárlás (75 pont)pypy3Time limit exceeded 39/75393ms90252 KiB
from sys import stdin

N = int(stdin.readline())

A = [0]
osszeg = 0
for x in stdin.readline().split():
	osszeg += int(x)
	A.append(osszeg)
B = [0]
osszeg = 0
for x in stdin.readline().split():
	osszeg += int(x)
	B.append(osszeg)
B.append(B[-1])
min_x = float('inf')
for i in range(1, N+1):
	A_eddig = A[i-1]
	for j in range(i, N+1):
		x = A[j] - A_eddig + B[i-1] - B[j]
		min_x = min(x, min_x)
print(min(min_x + B[-1], B[-1]))
SubtaskSumTestVerdictTimeMemory
base39/75
1Accepted0/043ms76048 KiB
2Time limit exceeded0/0375ms33716 KiB
3Accepted3/346ms77160 KiB
4Accepted4/446ms77144 KiB
5Accepted4/454ms87068 KiB
6Accepted4/456ms87060 KiB
7Accepted4/465ms88500 KiB
8Accepted3/364ms88760 KiB
9Accepted4/486ms89240 KiB
10Accepted4/481ms89336 KiB
11Accepted4/476ms89972 KiB
12Accepted5/576ms90252 KiB
13Time limit exceeded0/3363ms44384 KiB
14Time limit exceeded0/3370ms44688 KiB
15Time limit exceeded0/3370ms44876 KiB
16Time limit exceeded0/3384ms44820 KiB
17Time limit exceeded0/3384ms44848 KiB
18Time limit exceeded0/3393ms44820 KiB
19Time limit exceeded0/3382ms44852 KiB
20Time limit exceeded0/3372ms45640 KiB
21Time limit exceeded0/3370ms45396 KiB
22Time limit exceeded0/3365ms44500 KiB
23Time limit exceeded0/3368ms45520 KiB
24Time limit exceeded0/3377ms45432 KiB