BOJ 1927. 최소 힙 (Python)
BOJ 1927. 최소 힙 https://www.acmicpc.net/problem/1927 1927번: 최소 힙 첫째 줄에 연산의 개수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 연산에 대한 정보를 나타내는 정수 x가 주어진다. 만약 x가 자연수라면 배열에 x라는 값을 넣는(추가하는) 연산이고, x가 0 www.acmicpc.net 풀이 heapq를 이용해서 풀었다. 주의할 점 두가지는, python3로 제출할 경우 시간초과, pypy3로 제출 input()으로 할 시 시간초과, sys.stdin.readline().rstrip()로 할 것 python heapq 모듈 input()과 sys.stdin 소스코드 import heapq from sys import stdin N =..
2021.02.23