Skip to content

Commit

Permalink
Merge pull request #36 from AlgoLeadMe/8-wkdghdwns199
Browse files Browse the repository at this point in the history
8-wkdghdwns199
  • Loading branch information
wkdghdwns199 authored Feb 26, 2024
2 parents ff3a88d + 075829a commit 08722c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wkdghdwns199/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
| 6μ°¨μ‹œ | 2024.02.16 | μ•½μˆ˜, λ°°μˆ˜μ™€ μ†Œμˆ˜ | <a href="https://www.acmicpc.net/problem/13909">μ°½λ¬Έ λ‹«κΈ°</a> | <a href="">2024.02.16</a> |
| 7μ°¨μ‹œ | 2024.02.20 | μŠ€νƒ,큐,덱 | <a href="https://www.acmicpc.net/problem/24511">queuestack</a> | <a href="">2024.02.16</a> |

| 8μ°¨μ‹œ | 2024.02.16 | μŠ€νƒ, 큐, 덱 | <a href="https://www.acmicpc.net/problem/12789">도킀도킀 κ°„μ‹λ“œλ¦¬λ―Έ</a> | <a href="">2024.02.16</a> |

23 changes: 23 additions & 0 deletions wkdghdwns199/μŠ€ν…_큐_덱/ACM-12789.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
N = int(input())
order_list = list(map(int, input().split()))
order = 1
stack = []

# 5 4 2 3 1

while order_list :
if order_list[0] == order:
order_list.pop(0)
order+=1
else :
stack.append(order_list.pop(0))

while stack :
if stack[-1] == order:
stack.pop()
order +=1
else :
break


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

0 comments on commit 08722c3

Please sign in to comment.