题解 | 小苯的比赛上分

小苯的比赛上分

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

import heapq
m,n=input().split()
a=list(map(int,input().split()))
b=list(map(int,input().split()))
heapq.heapify(a)
maxscore=max(a)
for i in b:
    minscore=heapq.heappop(a)
    minscore+=i
    heapq.heappush(a,minscore)
    maxscore=max(maxscore,minscore)
    print(maxscore)



全部评论

相关推荐

04-13 09:56
已编辑
嵌入式工程师
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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