-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdontbelast.cpp
64 lines (62 loc) · 1.33 KB
/
dontbelast.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
#include<bits/stdc++.h>
using namespace std;
unordered_map<string,int> m = {{"Bessie",0},{"Elsie",0},{"Daisy",0},{"Gertie",0},{"Annabelle",0},{"Maggie",0},{"Henrietta",0}};
int main(){
//freopen("notlast.in", "r", stdin);
//freopen("notlast.out", "w", stdout);
int n, i;
//map<string,int> m;
cin >> n;
for(i=0;i<n;i++){
string s;
int b;
cin >> s >> b;
m[s]+=b;
}
set<int> a;
i=0;
vector<pair<int,string>> v;
for(auto x : m){
v.push_back({x.second,x.first});
a.insert(x.second);
}
sort(v.begin(),v.end());
for(auto x : a){
//cout << x << " ";
}
int count=v[0].first;
if((a.size()==1 || a.size()==2)&&n!=1){
cout << "Tie" << "\n";
}
else{
for(i=0;i<7;i++){
if(count!=v[i].first){
cout << v[i].second << "\n";
return 0;
}
}
}
}
/*
set<int> a;
vector<pair<int,string>> v;
for(auto x : m){
string s;
int b;
s=x.first;
b=x.second;
v.push_back({b,s});
}
sort(v.begin(),v.end());
int check=-1;
for(i=0;i<n;i++){
if(i==0)check=v[0].first;
else{
if(v[i].first!=check){
cout << v[i].second;
return 0;
}
}
}
}
*/