Last active
August 15, 2021 00:31
-
-
Save monhime/fc232fb70335c7b6f3617eafa2332a99 to your computer and use it in GitHub Desktop.
ABC214_C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from fractions import gcd | |
from collections import Counter, deque, defaultdict | |
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge | |
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort | |
from itertools import accumulate, product, permutations, combinations | |
from operator import itemgetter | |
import math # math.inf | |
import copy | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
inf = 10**10 | |
n = int(input()) | |
S = list(map(int,input().split())) | |
T = list(map(int,input().split())) | |
Isi = copy.deepcopy(T) | |
for i in range(1, n): | |
Isi[i] = min(Isi[i], Isi[i - 1] + S[i - 1]) | |
Isi[0] = min(Isi[0], Isi[-1] + S[-1]) | |
for i in range(1, n): | |
Isi[i] = min(Isi[i], Isi[i - 1] + S[i - 1]) | |
for i in range(n): | |
print(Isi[i]) | |
if __name__=='__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment