-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinalGrading.cpp
58 lines (53 loc) · 1.29 KB
/
finalGrading.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
typedef struct Node
{
string name;
int gp,gm,gf,g;
} node;
bool cmp(node a, node b){
return a.g!=b.g?a.g>b.g:a.name<b.name;
}
int main(){
int p,m,n;
cin>>p>>m>>n;
unordered_map<string, node> imap;
for(int i=0;i<p;i++){
string name;
int gp;
cin>>name>>gp;
if(gp<200) continue;
imap[name] = node{name, gp, -1, -1,-1};
}
for(int i=0;i<m;i++){
string name;
int gm;
cin>>name>>gm;
if(imap.find(name)==imap.end()) continue;
imap[name].gm=gm;
}
for(int i=0;i<n;i++){
string name;
int gf;
cin>>name>>gf;
if(imap.find(name)==imap.end()) continue;
imap[name].gf = gf;
if(imap[name].gm>imap[name].gf){
imap[name].g=round((float)imap[name].gm*0.4+(float)imap[name].gf*0.6);
}
else imap[name].g = imap[name].gf;
}
vector<node> res;
for(auto& v:imap){
if(v.second.g<60) continue;
res.push_back(v.second);
}
sort(res.begin(), res.end(), cmp);
for(int i=0;i<res.size();i++){
printf("%s %d %d %d %d\n", res[i].name.c_str(),res[i].gp,res[i].gm,res[i].gf,res[i].g);
}
}