闰土,评测
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int makk=0x3f3f3f,minn=-0x3f3f3f;
struct pe{
int k;
int s;
bool operator < (const pe &a) const{
if(s==a.s) return k>a.k;
return s<a.s;
}
bool operator > (const pe &a) const{
if(s==a.s) return k<a.k;
return s>a.s;
}
bool operator == (const pe &a) const{
if(s==a.s) return k==a.k;
return false;
}
bool operator != (const pe &a) const{
if(s==a.s) return k!=a.k;
return true;
}
bool operator = (const pe &a) {
s=a.s;
k=a.k;
}
bool operator >= (const pe &a) const{
if(s==a.s) return k<=a.k;
return s>=a.s;
}
};
void swap (pe *i,pe *j){
pe t;
t=*i;
*i=*j;
*j=t;
}
bool cmp (pe i,pe j){
if(i.s==j.s) return i.k>j.k;
return i.s<j.s;
}
pe a[10086];
int n,m;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i].k>>a[i].s;
}
sort(a+1,a+n+1,cmp);
pe *p=lower_bound(a+1,a+n+1,a[n-int(m*1.5)],cmp);
int i=n;
while(a[i]>=*p){
i--;
}
cout<<(*p).s<<' '<<n-i<<endl;
i=n;
while(a[i]>=*p){
cout<<a[i].k<<" "<<a[i].s<<endl;
i--;
}
return 0;
}