Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
- const long long MOD = 1e9 + 7, OO = 1e18;
- const double PI = acos(-1);
- const int N = 1e6 + 5;
- const int dx[4] = {0, 0, 1, -1};
- const int dy[4] = {1, -1, 0, 0};
- struct h {
- string name;
- long long a, v, s;
- };
- bool cmp(h hero1, h hero2)
- {
- if (hero1.a > hero2.a)return 1;
- if (hero1.a < hero2.a)return 0;
- if (hero1.v > hero2.v)return 1;
- if (hero1.v < hero2.v)return 0;
- if (hero1.s < hero2.s)return 1;
- if (hero1.s > hero2.s)return 0;
- return hero1.name < hero2.name;
- }
- /*
- hero1 hero2
- => hero2 hero1
- */
- long long n;
- h hero[N];
- int main()
- {
- IO
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- cin >> hero[i].name >> hero[i].a >> hero[i].v >> hero[i].s;
- }
- sort(hero + 1, hero + n + 1, cmp);
- for (int i = 1; i <= n; i++)
- {
- cout << hero[i].name << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment