Skip to content

Commit

Permalink
시간초과 에러나는 코드
Browse files Browse the repository at this point in the history
  • Loading branch information
JangHongJoon committed Feb 23, 2024
1 parent db22a6a commit 9bc6f67
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions wkdghdwns199/스텍_큐_덱/ACM-12789.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
N = int(input())
order_list = list(map(int, input().split()))
order = 1
stack = []

for student in order_list :
if student > order :
stack.append(student)
elif student == order :
order+=1

while len(stack) !=0 :
if len(stack) == 1 or stack[len(stack)-2] > stack[len(stack)-1] :
stack.pop()
else : break

print('Nice') if len(stack)==0 else print('Sad')

0 comments on commit 9bc6f67

Please sign in to comment.