mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 17:51:58 +00:00
CF2A Winner
R42010428
This commit is contained in:
parent
f988e1372a
commit
e2c361566e
27
problem/CF2A/CF2A.cpp
Normal file
27
problem/CF2A/CF2A.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n, t, max_score = -0x3f3f3f3f;
|
||||
int scores[1005];
|
||||
string s, max_player, players[1005];
|
||||
map<string, int> m, m1;
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> players[i] >> scores[i];
|
||||
m[players[i]] += scores[i];
|
||||
}
|
||||
for (int i = 0; i < n; i++) {
|
||||
max_score = max(max_score, m[players[i]]);
|
||||
}
|
||||
for (int i = 0; i < n; i++) {
|
||||
m1[players[i]] += scores[i];
|
||||
if (m[players[i]] == max_score && m1[players[i]] >= max_score) {
|
||||
max_player = players[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
cout << max_player << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user