20pts求调
查看原帖
20pts求调
1246000
osu_rice222楼主2024/8/5 16:46
#include <bits/stdc++.h>
using namespace std;
int n,m;
struct node{
	string name;
	long long num;
}a[100005],b[100005];
int cmp(node x,node y){
	return x.num>y.num;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	string p1;
	char p2;
	long long p3;
	int cnt=0,cnt2=0;
	for(int i=1;i<=n+m;i++){
		cin>>p1>>p2>>p3;
		if(p2=='S'){
			a[++cnt].name=p1;
			a[cnt].num=p3;
		}
		else{
			b[++cnt2].name=p1;
			b[cnt2].num=p3;
		}
	}
	sort(a+1,a+1+n,cmp);
	sort(b+1,b+1+n,cmp);
	cout<<b[m].name<<'\n';
	for(int i=n-3;i<=n;i++){
		cout<<a[i].name<<'\n';
	}
	return 0;
}
2024/8/5 16:46
加载中...