자꾸 틀렸다는 나의 코드ㅠㅠ
import sys
n = int(sys.stdin.readline().split()[0])
target_list = []
for i in range(n):
num = int(sys.stdin.readline().split()[0])
target_list.append(num)
print_list = []
stack_list = []
is_sequence = True
nums = [x for x in range(1, n+1)]
while target_list:
target = target_list.pop(0)
if stack_list and stack_list[-1] == target:
stack_list.pop()
print_list.append("-")
else: # stack_list가 비었거나 stack_list[-1]이 target과 다를 때 push를 합니다
if not nums:
is_sequence = False
break
stack_list.append(nums.pop(0))
print_list.append("+")
if is_sequence:
for p in print_list:
print(p)
else:
print("NO")
n = int(input())
count = 1
stack = []
result = []
for i in range(1, n+1):
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))