如下
#include<bits/stdc++.h>
using namespace std;
int n;
struct student {
string name;
int test_score;
int class_score;
char official;
char west;
int paper;
};
int calc(const student &s) {
int bonus = 0;
if (s.test_score > 80 && s.paper >= 1) bonus += 8000;
if (s.test_score > 85 && s.class_score > 80) bonus += 4000;
if (s.test_score > 90) bonus += 2000;
if (s.test_score > 85 && s.west == 'Y') bonus += 1000;
if (s.test_score > 80 && s.official == 'Y') bonus += 850;
return bonus;
}
vector< pair<string, int>> bonus;
int all_bonus = 0;
int main()
{
std::cin >> n;
for(int i = 0; i < n; i++){
student s;
std::cin >> s.name >> s.test_score >> s.class_score >> s.official >> s.west >> s.paper;
int b = calc(s);
all_bonus += b;
bonus.push_back(make_pair(s.name, b));
}
sort(bonus.begin(), bonus.end(), [] (const pair<string, int> &a, const pair<string, int> &b) {
return a.second > b.second;
});
std::cout << bonus[0].first << '\n' << bonus[0].second << '\n' << all_bonus;
return 0;
}