蒟蒻80分求助!!!样例过2 3点WA了
查看原帖
蒟蒻80分求助!!!样例过2 3点WA了
937827
z13323110392楼主2023/8/23 17:03
#include<bits/stdc++.h>
using namespace std;
struct mark{
       int f;//分 数 
       int h;//号 码 
};
mark a[5001];
bool cmp(mark x,mark y)
{
    if(x.f>y.f) return 1;
	if(x.f==y.f&&x.h<y.h) return 1;
    return 0;  
}
int main()
{
    int n,m,xian,shu=0,re;
    cin>>n>>m; 
     re=floor(m*1.5);
    for(int i=0;i<n;i++)
    {
        cin>>a[i].h>>a[i].f;
    }
    sort(a,a+n,cmp);  
    xian=a[re].f;
    for(int i=0;i<n;i++)
    {
    	if(a[i].f>=xian){
			shu++;
		}
	}cout<<xian<<" "<<shu<<endl;
	for(int i=0;i<shu;i++){
			cout<<a[i].h <<" "<<a[i].f<<endl;
	}
	return 0;
}
2023/8/23 17:03
加载中...