90072024-02-11 17:14:34FarkasZénóVásárlás (75 pont)pypy3Time limit exceeded 39/75455ms89416 KiB
from sys import stdin

N = int(stdin.readline())

A = [0] * (N + 1)
osszeg = 0
for i, x in enumerate(stdin.readline().split()):
	osszeg += int(x)
	A[i+1] = osszeg
B = [0] * (N + 1)
osszeg = 0
for i, x in enumerate(stdin.readline().split()):
	osszeg += int(x)
	B[i+1] = 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/043ms76068 KiB
2Time limit exceeded0/0451ms32120 KiB
3Accepted3/339ms77188 KiB
4Accepted4/439ms77224 KiB
5Accepted4/448ms86416 KiB
6Accepted4/448ms86152 KiB
7Accepted4/457ms87296 KiB
8Accepted3/364ms87224 KiB
9Accepted4/479ms88712 KiB
10Accepted4/482ms88924 KiB
11Accepted4/479ms89192 KiB
12Accepted5/575ms89416 KiB
13Time limit exceeded0/3363ms42428 KiB
14Time limit exceeded0/3368ms43108 KiB
15Time limit exceeded0/3358ms43252 KiB
16Time limit exceeded0/3372ms43608 KiB
17Time limit exceeded0/3372ms44124 KiB
18Time limit exceeded0/3379ms43996 KiB
19Time limit exceeded0/3358ms44556 KiB
20Time limit exceeded0/3370ms44028 KiB
21Time limit exceeded0/3455ms44340 KiB
22Time limit exceeded0/3382ms43420 KiB
23Time limit exceeded0/3382ms44184 KiB
24Time limit exceeded0/3361ms44240 KiB