Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- struct st
- {
- string name;
- int a;
- int b;
- int c;
- };
- st arr[1000001];
- bool comp(st x, st y)
- {
- if(x.a==y.a && x.b==y.b && x.c==y.c && x.name>=y.name)
- return false;
- else if(x.a==y.a && x.b==y.b && x.c<y.c)
- return false;
- else if(x.a==y.a && x.b>y.b)
- return false;
- else if(x.a<y.a)
- return false;
- else
- return true;
- }
- int main() {
- int n;
- cin>>n;
- for(int i=0; i<n; i++)
- {
- cin>>arr[i].name>>arr[i].a>>arr[i].b>>arr[i].c;
- }
- sort(arr,arr+n,comp);
- for(int i=0; i<n; i++)
- {
- cout<<arr[i].name<<"\n";
- }
- }
Add Comment
Please, Sign In to add comment