sicily 1299. Academy Awards

#include<iostream>
#include
<string>
#include
<map>
using namespace std;
struct film
{
int id,time;
};
int main()
{
int n,m;
string str,ss;
while(cin>>n,n)
{
map
<string,film> col;
int id=1;
while(n--)
{
cin
>>ss>>m;
while(m--)
{
cin
>>str;
if(col.find(str)!=col.end())
{
col[str].time
++;
}
else
{
col[str].id
=id++;
col[str].time
=1;
}
}
}
string res;
int Max=0,Min_id=1000;
for(map<string,film>::iterator ite=col.begin();ite!=col.end();++ite)
{
if( ite->second.time>Max || (ite->second.time==Max&&ite->second.id<Min_id) )
{
res
=ite->first;
Max
=ite->second.time;
Min_id
=ite->second.id;
}
}
cout
<<res<<endl;
}
return 0;
}

  

posted on 2011-07-17 12:06  sysu_mjc  阅读(210)  评论(0编辑  收藏  举报

导航