可以参考一下
```
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct node
{
int a,b;
};
node a[5005];
bool cmp(node x,node y)
{
return x.b > y.b || (x.b == y.b && x.a < y.a);
}
int n , m , cnt;
int main()
{
cin >> n >> m;
for(int i = 1;i <= n;i++)
cin >> a[i].a >> a[i].b;
sort(a + 1 , a + 1 + n , cmp);
m *= 1.5;
cnt = m;
for(int i = m + 1;i <= n;i++)
{
if(a[i].b == a[m].b)
cnt++;
else
break;
}
cout << a[m].b << " " << cnt <<endl;
for(int i = 1;i <= cnt;i++)
cout << a[i].a << " " << a[i].b << endl;
return 0;
}
by cute_overmind @ 2023-10-18 22:43:25