B3680求助!!被第五人格切了
  • 板块灌水区
  • 楼主_sweetydd_
  • 当前回复5
  • 已保存回复5
  • 发布时间2024/1/18 10:20
  • 上次更新2024/1/18 15:02:44
查看原帖
B3680求助!!被第五人格切了
767393
_sweetydd_楼主2024/1/18 10:20

rt,代码

#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;

struct ss {
	string s;
	int v;
} a[maxn];

long long cnth, cnts;
struct hh {
	string s;
	int v;
} b[maxn];

bool cmp(ss x, ss y) {
	return x.v > y.v;
}

bool cmp2(hh x, hh y) {
	return x.v > y.v;
}

int main() {
	int n, m;
	cin >> n >> m;
	string z, name;
	long long v;
	for (int i = 1; i <= n + m; i++) {
		cin >> name >> z >> v;
		if (z == "H") {
			cnth++;
			b[i].s = name;
			b[i].v = v;
		}
		if (z == "S") {
			cnts++;
			a[i].s = name;
			a[i].v = v;
		}
	}
	sort(a + 1, a + cnts + 1, cmp);
	sort(b + 1, b + cnth + 1, cmp2);
	cout << b[3].s << endl;
	for (int i = 6; i <= 9; i++) {
		cout << a[i].s << endl;
	}
	return 0;
}

2024/1/18 10:20
加载中...