80分求调,玄关
查看原帖
80分求调,玄关
1422628
Huayecai楼主2024/8/15 22:19
#include<bits/stdc++.h>
using namespace std;
struct s{
	int e;
	int f;
}c[5050];
bool cmp(s x,s y){
	if(x.f>y.f){
		return true;
	}else if(x.f==y.f){
		if(x.e<y.e){
			return true;
		}else{
			return false;
		}
		
	}else{
		return false;
	}
} 
int main(){
	int a,b,l,ans=0;
	cin>>a>>b;
	
	for(int i=0;i<a;i++){
		cin>>c[i].e>>c[i].f;
	}
    sort(c,c+a,cmp);
	
	b=b*3/2;
	l=c[b].f;
	cout<<l<<' ';
	for(int i=0;i<a;i++){
		if(c[i].f>=l){
			ans+=1;
		}
	}
	cout<<ans<<endl;
	for(int i=0;i<ans;i++){
		cout<<c[i].e<<' '<<c[i].f<<endl;
	}
	
	
	
}
2024/8/15 22:19
加载中...