핵심은 이미 푼 문제를 각 힙에서 제거하는 매커니즘. import sys input = sys.stdin.readline from heapq import heappop,heappush from collections import defaultdict N = int(input()) min_heap = [] max_heap = [] in_list = defaultdict(bool) for _ in range(N): P, L = map(int, input().split()) heappush(min_heap,[L,P]) heappush(max_heap,[-L,-P]) in_list[P] = True M = int(input()) for _ in range(M): command = input().split() if..