Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- vector<pair<int, int> > v;
- int x, p;
- for(int i = 1; i <= n; i ++)
- {
- cin >> x >> p;
- v.pb({p, x});
- }
- sort(v.begin(), v.end());
- reverse(v.begin(), v.end());
- for(int i = 0; i < n; i ++)
- {
- cout << v[i].second << " " << v[i].first << "\n";
- }
- }
Add Comment
Please, Sign In to add comment