https://www.acmicpc.net/problem/1874
Python
n = int(input())
count = 1
stack = []
result = []
for i in range(n):
data = int(input())
while count <= data:
stack.append(count)
count += 1
result.append('+')
if stack[-1] == data:
stack.pop()
result.append('-')
else:
print('NO')
exit(0)
print("\n".join(result))
댓글