Official

B - 白雪の新記録 / New Snowfall Records Editorial by sounansya Editorial for printing


それまでの積雪量の最大値を保持し、それより多く降った場合は o を、そうでないばあいは x を順に出力していけば良いです。

実装例(Python3)

n = int(input())
a = list(map(int, input().split()))
now = -1
ans = ""
for i in range(n):
    if now < a[i]:
        now = a[i]
        ans += "o"
    else:
        ans += "x"
print(ans)

posted:
last update: