20分求助
查看原帖
20分求助
1182672
python18楼主2024/4/1 21:17
#include<bits/stdc++.h>
using namespace std;
struct f{
	int id;
	int score;
};
bool cmp(f a , f b)
{
	if(a.score>b.score) return 1;
	else if(a.score==b.score&&a.id<b.id) return 1;
	return 0;
}
f human[15000];
int n , m ;
int wire,num,cnt;
int main()
{
	scanf("%d%d", &n , &m ) ;
	for(int i = 1 ; i <= n ; i ++)
	{
		scanf("%d%d", &human[i].id , &human[i].score);
	}
	sort(human + 1 , human + 1 + n , cmp );
	wire=m*1.5;
	num=human[wire].score;
	for(int i=1;i<=n;i++)
	{
		if(human[i].score<num) n--;
	}
	cnt=n;
	cout<<num<<" "<<cnt<<endl;
	for(int i=1;i<=cnt;i++)
	{
		
		cout<<human[i].id<<" "<<human[i].score<<endl;
	}
	return 0;
} 
























20分求助

喵

2024/4/1 21:17
加载中...