社区讨论

0分求助,悬1关

P1068[NOIP 2009 普及组] 分数线划定参与者 4已保存回复 6

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
6 条
当前快照
1 份
快照标识符
@lo15p32u
此快照首次捕获于
2023/10/22 15:37
2 年前
此快照最后确认于
2023/11/02 15:11
2 年前
查看原帖
CPP
#include <bits/stdc++.h>
using namespace std;
struct msz{
	int xh,fs;
}a[5005];
bool cmp(msz a,msz b){
	if(a.fs!=b.fs){
		return a.fs>b.fs;
	}else{
		return a.xh>b.xh;
	}
}
int main(){
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=n;i++){
		cin >> a[i].xh >> a[i].fs;
	}
	sort(a+1,a+1+n,cmp);
	m=floor(m*1.5);
	int i=m+1;
	while(a[i].fs==a[m].fs){
		i++;
	}
	cout << a[m].fs << " " << i << endl;
	for(int j=1;j<=i-1;j++){
		cout << a[j].xh << " " << a[j].fs << endl;
	}
	return 0;
}
为啥零分

回复

6 条回复,欢迎继续交流。

正在加载回复...