| 8 | using namespace std; |
| 9 | |
| 10 | int main() |
| 11 | { |
| 12 | int n; |
| 13 | cin >> n; |
| 14 | vector<vector<string>> A(n, vector<string>(2)); |
| 15 | for (int i = 0; i < n; i++) |
| 16 | { |
| 17 | cin >> A[i][0] >> A[i][1]; |
| 18 | } |
| 19 | |
| 20 | map<string, int> m; |
| 21 | map<string, int> count; |
| 22 | for (int i = 0; i < n; i++) |
| 23 | { |
| 24 | m[A[i][0]] += stoi(A[i][1]); |
| 25 | cout << m[A[i][0]] << endl; |
| 26 | count[A[i][0]]++; |
| 27 | } |
| 28 | int max = 0; |
| 29 | string name; |
| 30 | for (auto i : m) |
| 31 | { |
| 32 | // cout << i.first << " " << i.second << endl; |
| 33 | // cout << i.first << " " << round(i.second / count[i.first]) << endl; |
| 34 | if (round (1.0 * i.second / count[i.first]) > max) |
| 35 | { |
| 36 | max = round(i.second / count[i.first]); |
| 37 | name = i.first; |
| 38 | } |
| 39 | } |
| 40 | cout << name << " " << max << endl; |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 |
nothing calls this directly
no outgoing calls
no test coverage detected