Saleh127

Untitled

May 5th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define pb push_back
  3. using namespace std;
  4. int main()
  5. {
  6. int n;
  7. cin >> n;
  8. vector<pair<int, int> > v;
  9. int x, p;
  10. for(int i = 1; i <= n; i ++)
  11. {
  12. cin >> x >> p;
  13. v.pb({p, x});
  14. }
  15. sort(v.begin(), v.end());
  16. reverse(v.begin(), v.end());
  17. for(int i = 0; i < n; i ++)
  18. {
  19. cout << v[i].second << " " << v[i].first << "\n";
  20. }
  21. }
Add Comment
Please, Sign In to add comment