ABC87 C - Candies を解いた






全探索でよいのでは?

Candies.py
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]

ans = 0
for i in range(N):
    score = 0
    for j in range(N):
        if j == i:
            score += A[0][j]
            score += A[1][j]
        elif j < i:
            score += A[0][j]
        elif j > i:
            score += A[1][j]
    ans = max(ans,score)

print(ans)

一応通った