From 9bc6f674a0963f9ec60af3c5e581dea7017ae563 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Fri, 23 Feb 2024 11:06:22 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=9C=EA=B0=84=EC=B4=88=EA=B3=BC=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=EB=82=98=EB=8A=94=20=EC=BD=94=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ACM-12789.py" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "wkdghdwns199/\354\212\244\355\205\215_\355\201\220_\353\215\261/ACM-12789.py" diff --git "a/wkdghdwns199/\354\212\244\355\205\215_\355\201\220_\353\215\261/ACM-12789.py" "b/wkdghdwns199/\354\212\244\355\205\215_\355\201\220_\353\215\261/ACM-12789.py" new file mode 100644 index 0000000..e9d70ba --- /dev/null +++ "b/wkdghdwns199/\354\212\244\355\205\215_\355\201\220_\353\215\261/ACM-12789.py" @@ -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') \ No newline at end of file