https://pintia.cn/problem-sets/994805260223102976/problems/994805261493977088
测试点3是指总分是59.5也算合格,,是不是很坑??
题不难 用map 很麻烦
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
struct node{
double G1 = -1, G2 = -1, G3 = -1, G = 0.0;
string name;
};
bool cmp(node a, node b){
if((int)(a.G+0.5) == (int)(b.G+0.5)) return a.name < b.name;
else return a.G > b.G;
}
node stu[30003];
int main(){
map<string, int> match;
int m, n, k, sub = 1;
cin >> m >> n >> k;
for(int i = 1; i <= m; i++){
cin >> stu[i].name >> stu[i].G1;
match[stu[i].name] = sub++;
}
for(int i = 0; i < n; i++){
string tmpn;
int tmps;
cin >> tmpn >> tmps;
if(match[tmpn])
stu[match[tmpn]].G2 = tmps;
else{
stu[sub].name = tmpn;
stu[sub].G2 = tmps;