全wa,求改
查看原帖
全wa,求改
1138325
MC_dream_tsr楼主2024/8/20 16:15
# include<bits/stdc++.h>
using namespace std;
struct A{
	int k, s, id;
}a[5005];
bool cmp(A x, A y){
	if(x.s != y.s) return x.s > y.s;
	else return x.id < y.id;
}
int main(){
	int n, m, ans = 0;
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		cin >> a[i].k >> a[i].s;
		a[i].id = i;
	}	
	sort(a + 1, a + 1 + n, cmp);
	int x = a[m].s * 1.5;
	cout << x << " ";
	for(int i = 1; i <= n; i++)
		if(a[i].s >= x) ans++;
		else break;
	cout << ans << endl;
	for(int i = 1; i <= ans; i++)
	    cout << a[i].k << " " <<a[i].s << endl;
	return 0;
}
2024/8/20 16:15
加载中...