12345678910111213141516171819202122232425262728 |
- #include<bits/stdc++.h>
- using namespace std;
-
- int main()
- {
- int n;
- cin>>n;
- vector<double>a,b;
- for(int i=0;i<n;i++){
- string s;
- double x;
- cin>>s>>x;
- if(s=="male"){
- a.push_back(x);
- }else{
- b.push_back(x);
- }
- }
- sort(a.begin(),a.end());
- sort(b.begin(),b.end(),greater<double>());
- for(int i=0;i<a.size();i++)cout<<fixed<<setprecision(2)<<a.at(i)<<" ";
- for(int i=0;i<b.size();i++){
- if(i)cout<<" ";
- cout<<fixed<<setprecision(2)<<b.at(i);
- }
- cout<<endl;
- }
|