코드 # 파이썬은 최소힙 # -를 이용해 최대힙으로 활용해 해결 # 처음 넣을 때 다솜이 값을 따로 받고 # 그 다음 값부터 heappush를 사용했으면 더 쉽게 풀었을 문제 import sys, heapq input = sys.stdin.readline n = int(input()) lst = [-int(input()) for _ in range(n)] if n == 1: print(0) exit(0) dasom = -lst[0] lst2 = lst[1:] # 리스트를 잘라준다. heapq.heapify(lst2) # 넣어줄 때 heappush를 사용하지 않아서 heapify 사용 cnt = 0 while 1: pn = -heapq.heappop(lst2) if dasom > pn: break pn -..