90042024-02-11 17:07:09FarkasZénóVásárlás (75 pont)python3Time limit exceeded 15/75456ms32924 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
base15/75
1Accepted0/018ms11388 KiB
2Time limit exceeded0/0398ms12532 KiB
3Accepted3/317ms12292 KiB
4Accepted4/417ms12712 KiB
5Accepted4/421ms12756 KiB
6Accepted4/421ms13000 KiB
7Time limit exceeded0/4352ms5912 KiB
8Time limit exceeded0/3379ms5752 KiB
9Time limit exceeded0/4370ms6236 KiB
10Time limit exceeded0/4375ms6288 KiB
11Time limit exceeded0/4360ms6380 KiB
12Time limit exceeded0/5382ms6272 KiB
13Time limit exceeded0/3398ms22008 KiB
14Time limit exceeded0/3363ms22788 KiB
15Time limit exceeded0/3370ms24172 KiB
16Time limit exceeded0/3451ms25348 KiB
17Time limit exceeded0/3372ms26432 KiB
18Time limit exceeded0/3363ms27716 KiB
19Time limit exceeded0/3363ms29264 KiB
20Time limit exceeded0/3384ms29656 KiB
21Time limit exceeded0/3375ms30764 KiB
22Time limit exceeded0/3372ms27724 KiB
23Time limit exceeded0/3456ms32168 KiB
24Time limit exceeded0/3367ms32924 KiB