Guest User

Untitled

a guest
Jul 16th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4. using namespace std;
  5. struct st
  6. {
  7. string name;
  8. int a;
  9. int b;
  10. int c;
  11. };
  12. st arr[1000001];
  13. bool comp(st x, st y)
  14. {
  15. if(x.a==y.a && x.b==y.b && x.c==y.c && x.name>=y.name)
  16. return false;
  17. else if(x.a==y.a && x.b==y.b && x.c<y.c)
  18. return false;
  19. else if(x.a==y.a && x.b>y.b)
  20. return false;
  21. else if(x.a<y.a)
  22. return false;
  23. else
  24. return true;
  25. }
  26. int main() {
  27. int n;
  28. cin>>n;
  29. for(int i=0; i<n; i++)
  30. {
  31. cin>>arr[i].name>>arr[i].a>>arr[i].b>>arr[i].c;
  32. }
  33. sort(arr,arr+n,comp);
  34. for(int i=0; i<n; i++)
  35. {
  36. cout<<arr[i].name<<"\n";
  37. }
  38. }
Add Comment
Please, Sign In to add comment