社区讨论
又是题解,无博客Ganges
P1068[NOIP 2009 普及组] 分数线划定参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @mi6ywkoa
- 此快照首次捕获于
- 2025/11/20 13:05 4 个月前
- 此快照最后确认于
- 2025/11/20 13:05 4 个月前
#include
#include
using namespace std;
struct people{
CPPint no, score;
};
people a[5005];
int n, m;
bool cmp(people a, people b) {
CPPif (a.score != b.score) return a.score > b.score;
else return a.no < b.no;
}
int main() {
CPP//freopen("score.in", "r", stdin);
//freopen("score.out", "w", stdout);
scanf("%d%df", &n, &m);
for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].no, &a[i].score);
sort(a + 1, a + n + 1, cmp);
m = m * 1.5;
int scoret = a[m].score;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (a[i].score >= scoret) { ans++; continue; }
else break;
}
printf("%d %d\n", scoret, ans);
for (int i = 1; i <= ans; i++) printf("%d %d\n", a[i].no, a[i].score);
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...