题解
2024-12-14 19:47:45
发布于:广东
15阅读
0回复
0点赞
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct node{
int id, score;
}a[5005];
bool cmp(node a, node b){
if(a.score == b.score) return a.id < b.id;
return a.score > b.score;
}
int main(){
int n, m;
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; i++){
scanf("%d%d", &a[i].id, &a[i].score);
}sort(a + 1, a + n + 1, cmp);
int x = m * 1.5;
int s = a[x].score;
int ct = 0;
for(int i = 1; a[i].score >= s; i++){
ct++;
}printf("%d %d\n", s, ct);
for(int i = 1; i <= ct; i++){
printf("%d %d\n", a[i].id, a[i].score);
}
return 0;
}
这里空空如也
有帮助,赞一个