-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinal Grading.cpp
68 lines (66 loc) · 1.52 KB
/
Final Grading.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
59
60
61
62
63
64
65
66
67
68
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
struct node
{
std::string name;
double Gp = -1, Gm = -1, Gf = -1;
int fin;
};
std::map<std::string, node> s;
bool cmp(node a, node b)
{
if (a.fin == b.fin)
return a.name < b.name;
return a.fin > b.fin;
}
int main()
{
int p, m, n;
std::cin >> p >> m >> n;
for (int i = 0; i < p; i++)
{
std::string t;
std::cin >> t;
s[t].name = t;
std::cin >> s[t].Gp;
}
for (int i = 0; i < m; i++)
{
std::string t;
std::cin >> t;
s[t].name = t;
std::cin >> s[t].Gm;
}
for (int i = 0; i < n; i++)
{
std::string t;
std::cin >> t;
s[t].name = t;
std::cin >> s[t].Gf;
}
std::vector<node> ans;
for (std::map<std::string, node>::iterator it = s.begin(); it != s.end(); it++)
{
if (it->second.Gp >= 200 && it->second.Gf >= 60)
{
if (it->second.Gm > it->second.Gf)
it->second.fin = int(it->second.Gm * 0.4 + it->second.Gf * 0.6 + 0.5);
else
it->second.fin = it->second.Gf;
ans.push_back(it->second);
}
}
std::sort(ans.begin(), ans.end(), cmp);
for (int i = 0; i < ans.size(); i++)
{
std::cout << ans[i].name << " "
<< ans[i].Gp << " "
<< ans[i].Gm << " "
<< ans[i].Gf << " "
<< ans[i].fin << std::endl;
}
return 0;
}