题解 | 【模板】整数优先队列

【模板】整数优先队列

https://www.nowcoder.com/practice/a88e9711f7b04369982bbe8902278ae4

import heapq
n=int(input())
heap=[]
for i in range(n):
    s=list(map(int,input().split()))
    if int(s[0])==1:
        heapq.heappush(heap,s[1])
    elif s[0]==2:
        print(heap[0])    
    elif s[0]==3:
        heapq.heappop(heap)
    

全部评论

相关推荐

xtu大迫杰:偶遇校友,祝校友offer打牌
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务