P1068 [NOIP2009 普及组] 分数线划定 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
知识点:
这道题用到了自定义排序规则
n, m = map(int,input().split())
data = []
for i in range(n):l = list(map(int,input().split()))data.append(l)import functoolsdef my_cmp(a,b):if a[1] == b[1]:if a[0]>b[0]:return 1return -1else:if a[1]<b[1]:return 1return -1data.sort(key=functools.cmp_to_key(my_cmp))s = []
for i in data:s.append(i[1])s.sort(reverse=True)
ans = 0
result = []
m = int(m*1.5)
for i in data:if i[1] in s[:m]:result.append(i)ans += 1
print(f'{s[m-1]} {ans}')
for i in result:print(f'{i[0]} {i[1]}')