Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <math.h>
- #include <algorithm>
- using namespace std;
- struct team
- {
- long long int ID, M, n;
- };
- bool m(team p1, team p2)
- {
- if (p1.M == p2.M)
- return p1.n > p2.n;
- else
- return p1.M < p2.M;
- }
- team grop[150000];
- int main()
- {
- int i, N;
- cin >> N;
- for (i = 0; i < N; i++)
- {
- cin >> grop[i].ID >> grop[i].M;
- grop[i].n = i;
- }
- sort(grop, grop + N, m);
- for (i = N-1; i >= 0; i--)
- cout << grop[i].ID << " " << grop[i].M << endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement