Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <algorithm>
- using namespace std;
- struct teams {
- string name;
- int s;
- int p;
- };
- bool compare(teams lhs, teams rhs) {
- if (lhs.s != rhs.s) {
- return lhs.s > rhs.s;
- }
- else if (lhs.p != rhs.s) {
- return lhs.p < rhs.p;
- }
- else if (lhs.name != rhs.name) {
- return lhs.name < rhs.name;
- }
- }
- int main() {
- int n, i;
- cin >> n;
- vector <teams> t(n);
- for (i = 0; i < n; i++) {
- cin >> t[i].name >> t[i].s >> t[i].p;
- }
- sort(t.begin(), t.end(), compare);
- for (i = 0; i < n; i++) {
- cout << t[i].name << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement