Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool comp(pair<double, string> &a, pair<double, string> &b)
- {
- if (a.first == b.first)
- return a.second < b.second;
- else
- return a.first > b.first;
- }
- void solve()
- {
- int n, holder = 0;
- double k, d, a;
- string s;
- cin >> n;
- vector<pair<double, string>> v(n);
- while (n--)
- {
- cin >> s >> k >> d >> a;
- v[n].first = k + (a * 1 / 2) - (d * 3 / 4);
- v[n].second = s;
- }
- sort(all(v), comp);
- cout << v[0].second << " " << holder << endl;
- for (int i = 1; i < v.size(); i++)
- {
- if (v[i].first == v[i - 1].first)
- {
- cout << v[i].second << " " << holder << endl;
- }
- else
- cout << v[i].second << " " << i << endl, holder = i;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment