样例过了但0分
查看原帖
样例过了但0分
738896
pisuom楼主2023/5/14 20:30
#include <bits/stdc++.h>
using namespace std;
struct stu {
	int id,fs;
} a[31];
bool cmp(stu a,stu b) {
	if (a.fs!=b.fs) {
		return a.fs>b.fs;
	} else {
		if (a.id < b.id) swap(a.id,b.id);
	}
}
int main() {
	int n,m,cnt=0;
	cin >> n >> m;
	for (int i = 0; i < n ; i++) {
		cin >> a[i].id >> a[i].fs;
		if (a[i].fs>=a[int(m*1.5)].fs) cnt++;
	}
	sort(a,a+n,cmp);
	cout << a[int(m*1.5)].fs << " " << cnt << endl;
	for (int i = 0; i < cnt ; i++) cout << a[i].id << " " << a[i].fs << endl;
	return 0;
}

2023/5/14 20:30
加载中...