题目描述 https://www.luogu.org/problemnew/show/P1068
跟分数线相同分的人都能录取
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{
int nm,sc;
}a[5005];
int n,m;
bool cmp(const node &a,const node &b)
{
if(a.sc>b.sc) return 1;
if(a.sc<b.sc) return 0;
if(a.nm<b.nm) return 1;
return 0;
}
int main()
{
scanf("%d%d",&n,&m);
m=m/2+m;
for(int i=1;i<=n;i++) scanf("%d%d",&a[i].nm,&a[i].sc);
sort(a+1,a+n+1,cmp);
int score=a[m].sc;
while(a[m+1].sc==score) m++;
printf("%d %d\n",score,m);
for(int i=1;i<=m;i++)
printf("%d %d\n",a[i].nm,a[i].sc);
return 0;
}