Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* TAHMID RAHMAN
- DAMIAN FOREVER
- MATH LOVER
- NEVER GIVE UP
- */
- #include<bits/stdc++.h>
- using namespace std;
- #define pi acos(-1.0)
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
- #define ll long long
- #define pb push_back
- #define fi first
- #define se second
- #define in insert
- #define mp make_pair
- #define GCD(a,b) __gcd(a,b);
- #define endl "\n"
- #define FRU freopen("out.txt","w",stdout)
- #define FRO freopen("in.txt","r",stdin)
- #define INFLL 9223372036854775807
- #define debug 0
- #define MAXN 100001
- #define ar array
- const int mxN=2e5;
- const int MOD=1e9+7;
- bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
- //Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
- struct info{
- string name;
- int height,weight;
- ll income;
- };
- bool comp(info a,info b)
- {
- if(a.income==b.income)
- {
- if(a.height==b.height)
- {
- if(a.weight==b.weight)
- {
- return a.name<b.name;
- }
- else
- {
- return a.weight<b.weight;
- }
- }
- else
- return a.height>b.height;
- }
- else
- return a.income>b.income;
- }
- int main()
- {
- info a[4];
- int i;
- for(i=0;i<2;i++)
- {
- string s;
- cin>>s;
- a[i].name=s;
- int x,y;
- cin>>x;
- a[i].height=x;
- cin>>y;
- a[i].weight=y;
- ll z;
- cin>>z;
- a[i].income=z;
- }
- sort(a,a+2,comp);
- for(i=0;i<2;i++)
- {
- cout<<"Name :"<<a[i].name<<endl;
- cout<<"Income :"<<a[i].income<<endl;
- cout<<"Height :"<<a[i].height<<endl;
- cout<<"Weight :"<<a[i].weight<<endl;
- cout<<endl;
- }
- /*stack<ll>st;
- st.push(1);
- st.push(2);
- st.push(3);
- st.push(4);
- st.push(2);
- while(!st.empty())
- {
- cout<<st.top()<<endl;
- st.pop();
- }
- cout<<endl;
- queue<ll>q;
- q.push(1);
- q.push(10);
- q.push(2);
- q.push(3);
- while(!q.empty())
- {
- cout<<q.front()<<endl;
- q.pop();
- }
- cout<<endl;
- priority_queue<ll>pq;
- pq.push(100);
- pq.push(10001);
- pq.push(3);
- pq.push(11111111111);
- pq.push(0);
- while(!pq.empty())
- {
- cout<<pq.top()<<endl;
- pq.pop();
- }
- cout<<endl;*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement