ac代码“
#include <bits/stdc++.h>
using namespace std;
struct node
{
string name;
int h;
int w;
node()
{
h=-1;
w=-1;
}
};
node a[1000001];
map<int,node> mp;
int main()
{
int n;
cin>>n;
int e;//房间号不能用字符串
for(int i=0;i<n;i++)
{
cin>>e;
cin>>a[i].name>>a[i].h>>a[i].w;
if(mp[e].h<a[i].h )
mp[e]=a[i];
}
map<int,node> :: iterator it;
int cnt1=mp.size();
int cnt=0;
for(it=mp.begin();it!=mp.end();it++)
{
cnt++;
int num=it->first;
printf("%06d",num);//房间号不能用字符串!!
cout<<' '<<(it->second).name<<' '<<(it->second).h<<' '<<(it->second).w;
if(cnt!=cnt1) cout<<endl;
}
return 0;
}