Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Sort_Restaurant1/juchan/11004.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys

input = sys.stdin.readline

N, K = map(int, input().split())
nums = list(map(int, input().split()))

nums.sort()
print(nums[K-1])
# list sort 메소드는 O(nlogn)의 시간복잡도를 가진다.
# 백준기준 메모리 646904KB, 시간 2828ms

# from heapq import heappush, heappop

# heap = []

# for num in nums:
# heappush(heap, num)

# ans = 0
# for i in range(K):
# ans = heappop(heap)

# print(ans)
# heapq 모듈을 사용하면 O(nlogn)의 시간복잡도를 가진다.
# 백준기준 메모리 696680KB, 시간 4016ms

31 changes: 31 additions & 0 deletions Sort_Restaurant1/juchan/2750.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys

input = sys.stdin.readline

n = int(input())
# nums = []
# for _ in range(n):
# num = int(input())
# nums.append(num)

# nums.sort()
# for i in range(n):
# print(nums[i])

# list sort 메소드는 O(nlogn)의 시간복잡도를 가진다.
# 백준기준 메모리 114327KB, 시간 124ms

from heapq import heappush, heappop

heap = []

for _ in range(n):
num = int(input())
heappush(heap, num)

for i in range(n):
print(heappop(heap))

# heapq 모듈을 사용하면 O(nlogn)의 시간복잡도를 가진다.
# 백준기준 메모리 115268KB, 시간 140ms

30 changes: 30 additions & 0 deletions Sort_Restaurant1/juchan/2751.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sys

input = sys.stdin.readline

n = int(input())
nums = []
for _ in range(n):
num = int(input())
nums.append(num)

nums.sort()
for i in range(n):
print(nums[i])

# list sort 메소드는 O(nlogn)의 시간복잡도를 가진다.
# 백준기준 메모리 114327KB, 시간 124ms

# from heapq import heappush, heappop

# heap = []

# for _ in range(n):
# num = int(input())
# heappush(heap, num)

# for i in range(n):
# print(heappop(heap))

# heapq 모듈을 사용하면 O(nlogn)의 시간복잡도를 가진다.
# 백준기준 메모리 115268KB, 시간 140ms
8 changes: 8 additions & 0 deletions Sort_Restaurant1/juchan/2752.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import sys

input = sys.stdin.readline

nums = list(map(int, input().split()))

nums.sort()
print(*nums) # *을 붙이면 리스트의 요소들을 하나씩 출력