문제 : https://www.acmicpc.net/problem/1874


r = int(input())
stack =[]
chk = []
result = []
# 기본 세팅
for i in range(r) :
chk.append(int(input()))
idx = 0
for i in range(1,r+1) :
stack.append(i)
result.append("+")

while idx < r and len(stack) != 0 and chk[idx] == stack[-1] :
stack.pop()
result.append("-")
idx = idx + 1

if not stack :
for i in result :
print(i)
else :
print("NO")


+ Recent posts

"여기"를 클릭하면 광고 제거.