题目地址


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int MAXN=1e4;
struct Person{
	int index,score;
	bool operator <(Person another)const{
		return score==another.score?index<another.index:score>another.score;
	}
}persons[MAXN];
vector<Person> ans;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&persons[i].index,&persons[i].score);
	}
	sort(persons+1,persons+n+1);
	int cnt=floor(m*1.5);
	int lastScore=0;
	for(int i=1;i<=n;i++){
		int nowScore=persons[i].score;
		if(lastScore==nowScore){
			ans.push_back(persons[i]);
			continue;
		}else{
			if(i>cnt)break;
			ans.push_back(persons[i]);
			lastScore=nowScore;
		}
	}
	printf("%d %d\n",lastScore,ans.size());
	for(int i=0;i<ans.size();i++){
		printf("%d %d\n",ans[i].index,ans[i].score);
	}
	return 0;
}