90052024-02-11 17:07:43FarkasZénóVásárlás (75 pont)pypy3Time limit exceeded 39/75442ms105916 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):
	for j in range(i, N+1):
		x = A[j] - A[i-1] + B[i-1] - B[j]
		min_x = min(x, min_x)
print(min(min_x + B[-1], B[-1]))
SubtaskSumTestVerdictTimeMemory
base39/75
1Accepted0/048ms92164 KiB
2Time limit exceeded0/0363ms49456 KiB
3Accepted3/346ms92528 KiB
4Accepted4/443ms92872 KiB
5Accepted4/456ms102464 KiB
6Accepted4/450ms102516 KiB
7Accepted4/457ms103680 KiB
8Accepted3/365ms103628 KiB
9Accepted4/475ms105380 KiB
10Accepted4/474ms105448 KiB
11Accepted4/474ms105792 KiB
12Accepted5/585ms105916 KiB
13Time limit exceeded0/3370ms59980 KiB
14Time limit exceeded0/3384ms60252 KiB
15Time limit exceeded0/3377ms60452 KiB
16Time limit exceeded0/3384ms60484 KiB
17Time limit exceeded0/3377ms60604 KiB
18Time limit exceeded0/3381ms60480 KiB
19Time limit exceeded0/3372ms60416 KiB
20Time limit exceeded0/3377ms61104 KiB
21Time limit exceeded0/3368ms61028 KiB
22Time limit exceeded0/3375ms60264 KiB
23Time limit exceeded0/3442ms61184 KiB
24Time limit exceeded0/3381ms60768 KiB