1 solutions
-
0
#include<bits/stdc++.h> using namespace std; struct HYRout{ void intout(long long a,string end=""){ cout <<a <<end; } void floatout(long double a,string end=""){ cout <<a <<end; } void boolout(bool a,string end=""){ cout <<a <<end; } void charout(char a,string end=""){ cout <<a <<end; } void stringout(string a,string end=""){ cout <<a <<end; } }; struct HYRcom{ long double nsum(long double a,long double b){ return a+b; } bool bsum(bool a,bool b,string x="&"){ if(x=="&"){ return a&&b; } else if(x=="!"){ if(a==b){ return 0; } else{ return 1; } } else if(x=="|"){ return a||b; } else if(x=="!&"){ return bsum(!a,b); } else if(x=="&!"){ return bsum(a,!b); } else if(x=="!!"){ return !bsum(a,b,"!"); } else{ return 0; } } string ssum(string a,string b,string x="+"){ if(x=="+"){ return a+b; } if(x=="c+h"){ string c; for(int i=0;i<a.size()||i<b.size();i++){ c+=a[i]+b[i]; } return c; } if(x=="c+t"){ string c; for(int i=a.size()-1,j=b.size()-1;i>=0||j>=0;i--,j--){ if(i>=0&&j>=0)c+=a[i]+b[j]; if(i<0)c+=b[j]; if(j<0)c+=a[j]; } reverse(c.begin(),c.end()); return c; } return "wrong"; } char csum(char a,char b){ return a+b; } long double ndif(long double a,long double b){ return a-b; } char cdif(char a,char b){ return a-b; } string sdif(string a,string b,string x="c-t"){ if(x=="c-h"){ string c; for(int i=0;i<a.size()||i<b.size();i++){ c+=a[i]-b[i]; } return c; } if(x=="c-t"){ string c; for(int i=a.size()-1,j=b.size()-1;i>=0||j>=0;i--,j--){ if(i>=0&&j>=0)c+=a[i]-b[j]; if(i<0)c+=b[j]; if(j<0)c+=a[j]; } reverse(c.begin(),c.end()); return c; } return "wrong"; } long double npro(long double a,long double b){ return a*b; } char cpro(char a,char b){ return a*b; } string spro(string a,string b,string x="c*t"){ if(x=="c*h"){ string c; for(int i=0;i<a.size()||i<b.size();i++){ c+=a[i]*b[i]; } return c; } if(x=="c*t"){ string c; for(int i=a.size()-1,j=b.size()-1;i>=0||j>=0;i--,j--){ if(i>=0&&j>=0)c+=a[i]*b[j]; if(i<0)c+=b[j]; if(j<0)c+=a[j]; } reverse(c.begin(),c.end()); return c; } } long double ncuo(long double a,long double b){ return a/b; } long double intexp(long double a,long long x){ long double a1=a; for(long long i=1;i<x;i++)a*=a1; return a; } }; struct HYRbin{ long long intodec(string s,int x){ long long ret=0; int sum=1; for(int i=s.size()-1;i>-1;i--){ if(s[i]>='0'&&s[i]<='9') ret+=sum*int(s[i]-'0'); if(s[i]>='A'&&s[i]<='Z') ret+=sum*(10+int(s[i]-'A')); sum*=x; } return ret; } string intother(long long n,int x){ string ret; while(n>0){ if(n%x<10)ret+=char((n%x)+'0'); else ret+=char((n%x)-10+'A'); n/=x; } reverse(ret.begin(),ret.end()); return ret; } string ifoto(string s,int from,int to){ return intother(intodec(s,from),to); } }; /**/ struct r{ bool xb; double high; }; bool px(r r1,r r2){ if(r1.xb!=r2.xb) return r1.xb==1; if(r1.xb==1) return r1.high<=r2.high; else return r1.high>=r2.high; } /**/ int main(){ int n; cin >>n; r a[n]; for(int i=0;i<n;i++){ string s; cin >>s >>a[i].high; if(s=="male") a[i].xb=1; else a[i].xb=0; } cout <<setprecision(2) <<fixed; sort(a,a+n,px); for(int i=0;i<n;i++){ cout <<a[i].high <<" "; } }
- 1
Information
- ID
- 253
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 2
- Uploaded By