站外
  • 板块灌水区
  • 楼主ygwlan
  • 当前回复3
  • 已保存回复4
  • 发布时间2023/11/12 19:45
  • 上次更新2023/11/12 21:21:13
查看原帖
站外
747917
ygwlan楼主2023/11/12 19:45

https://qqwhale.com/group/420/training/3567/problem/1960

#include <bits/stdc++.h>
#define I using
#define AK namespace
#define IOI std
I AK IOI;
struct node{
	int id,score;
}a[6009];
bool cmp(node x,node y){
    if(x.score!=y.score){
        return x.score>y.score;
    }
    else
    return x.id<y.id;
}
int main(){
	int n,m;
	cin>>n>>m;
	m*=1.5;
	for(int i=1;i<=n;i++){
		cin>>a[i].id>>a[i].score;
	}
	sort(a+1,a+1+n,cmp);
	int st=a[m].score;
	int j=m;
	while(a[++j].score==st);
    j--;
	cout<<st<<" "<<j<<endl;
	for(int i=1;i<=j;i++){
		cout<<a[i].id<<" "<<a[i].score<<"\n"; 
	}
	return 0;
}

求hack

2023/11/12 19:45
加载中...