Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef struct niru{
  5.  
  6. string hero;
  7.  
  8. int a;
  9.  
  10. int v;
  11.  
  12. int s;
  13.  
  14. } niru;
  15.  
  16.  
  17.  
  18. bool cmp(niru b,niru c)
  19.  
  20. {
  21.  
  22. if(b.a>c.a)
  23.  
  24. return true;
  25.  
  26. else if(b.a==c.a && b.v>c.v)
  27.  
  28. return true;
  29.  
  30. else if(b.a==c.a && b.v==c.v && b.s<c.s)
  31.  
  32. return true;
  33.  
  34. else if(b.a==c.a && b.v==c.v && b.s==c.s && b.hero>c.hero)
  35.  
  36. return true;
  37.  
  38. }
  39.  
  40.  
  41.  
  42. int main()
  43.  
  44. {
  45.  
  46. niru ok;
  47. vector<niru> non;
  48.  
  49. long long int n,i,j;
  50. cin>>n;
  51. for(i=0;i<n;i++){
  52. cin>>ok.hero>>ok.a>>ok.v>>ok.s;
  53. non.push_back(ok);
  54. }
  55. sort(non.begin(),non.end(),cmp);
  56.  
  57. for(i=0;i<n;i++)
  58. {
  59. cout<<non[i].hero<<endl;
  60. }
  61.  
  62.  
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement