aj30

Untitled

Oct 12th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std ;
  3.  
  4. struct team{
  5. int id, ind, solved ;
  6. }ar[ 100005 ] ;
  7.  
  8. bool cmp( const team &a, const team &b ){
  9. return a.solved > b.solved ;
  10. }
  11.  
  12. int main( ){
  13. int n ;
  14. cin >> n ;
  15. for( int i = 0 ; i < n ; i++ ){
  16. cin >> ar[ i ].id >> ar[ i ].solved ;
  17. ar[ i ].ind = i ;
  18. }
  19. sort( ar, ar + n, cmp ) ;
  20. for( int i = 0 ; i < n ; i++ ){
  21. cout << ar[ i ].id << " " << ar[ i ].solved << '\n' ;
  22. }
  23.  
  24. }
Add Comment
Please, Sign In to add comment