题解 | 分数线划定

分数线划定

https://www.nowcoder.com/practice/2395fa7b6c6e452e8d8310a7cfdbe902

n,m = map(int,input().split())
t = (3 * m) // 2
d = {}
score=[]
for _ in range(n):
    k,s = map(int,input().split())
    d[k] = s
    score.append(s)
score.sort(reverse = True)
d_sorted = dict(sorted(d.items(), key=lambda x: (-x[1], x[0])))
line = score[t-1]
cnt = 0
for i in score:
    if i>=line:
        cnt+=1
print(f"{line} {cnt}")
for k,v in d_sorted.items():
    if d_sorted[k]>=line:
        print(f"{k} {v}")

    
            





      

全部评论

相关推荐

熊大不大:微信也是华为旗下吧,我看我朋友也是华为工牌写wx
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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