본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 16786번 すごろくと駒 (Sugoroku and Pieces)

by 현장 2023. 6. 28.

-Code

n = int(input())
pieces = list(map(int, input().split()))
m = int(input())
pos = list(map(int, input().split()))

for n in pos:
    n = n - 1
    if pieces[n] + 1 not in pieces:
        pieces[n] += 1

    if pieces[n] > 2019:
        pieces[n] = 2019
for i in pieces:
    print(i)