diff --git "a/seongwon030/\354\212\244\355\203\235/\354\230\244\355\201\260\354\210\230.py" "b/seongwon030/\354\212\244\355\203\235/\354\230\244\355\201\260\354\210\230.py" new file mode 100644 index 0000000..c2022c0 --- /dev/null +++ "b/seongwon030/\354\212\244\355\203\235/\354\230\244\355\201\260\354\210\230.py" @@ -0,0 +1,10 @@ +n = int(input()) +A = list(map(int,input().split())) +NGE = [-1]*n +stack = [0] + +for i in range(1,n): + while stack and A[stack[-1]] < A[i]: + NGE[stack.pop()] = A[i] + stack.append(i) +print(*NGE) \ No newline at end of file