AcWing 438. 分数线划定
原题链接
简单
作者:
偷月亮的喵
,
2024-12-23 11:16:39
,
所有人可见
,
阅读 3
#include<bits/stdc++.h>
using namespace std;
const int N=5010;
typedef struct{
int x,f;
}per;
per p[N],pt[N];
int n,m,k,t;
int cmp(per a,per b)
{
if(a.f != b.f) {
return a.f > b.f;
}
return a.x < b.x;
}
int main(){
scanf("%d%d",&n, &m);
for(int i = 1; i <= n; i++)
{
int a, b;
scanf("%d%d",&a,&b);
p[i]={a, b};
}
sort(p + 1, p + n + 1, cmp);
k=p[(int)(m * 1.5)].f;
for(int i = 1;i <= n; i++)
if(p[i].f >= k)
pt[++t] = p[i];
cout << k << " "<< t << endl;
for(int i = 1;i <= t; i++) cout << p[i].x << " " << p[i].f << endl;
return 0;
}