We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c7661b commit 33363aaCopy full SHA for 33363aa
21/2.py
@@ -0,0 +1,25 @@
1
+import sys
2
+import heapq
3
+input = sys.stdin.readline
4
+
5
+def heapsort(iterable):
6
+ h = []
7
+ result = []
8
+ # 모든 원소를 차례대로 힙에 삽입
9
+ for value in iterable:
10
+ heapq.heappush(h, value)
11
+ # 힙에 삽입된 모든 원소를 차례대로 꺼내어 담기
12
+ for i in range(len(h)):
13
+ result.append(heapq.heappop(h))
14
+ return result
15
16
+n = int(input())
17
+arr = []
18
19
+for i in range(n):
20
+ arr.append(int(input()))
21
22
+res = heapsort(arr)
23
24
25
+ print(res[i])
0 commit comments