#include <bits/stdc++.h>
using namespace std;
bool compare( const pair<string,long long int>& x, const pair<string, long long int>& y )
{
return (x.second>y.second); //descending
}
int main()
{
long long int t,n,i,j,k,m;
string s;
vector<pair<string,long long int> >a;
//freopen("12015.txt","r",stdin);
//freopen("12015out.txt","w",stdout);
cin>>t;
for(i=1;i<=t;i++)
{
m=0;
a.clear();
for(j=1;j<=10;j++)
{
cin>>s>>n;
if(m<n)
{
m=n;
}
a.push_back(make_pair(s,n));
}
stable_sort(a.begin(),a.end(),compare);
vector<pair<string,long long int> >::iterator p;
printf("Case #%lld:\n",i);
for(p=a.begin();p!=a.end();p++)
{
if(m==p->second)
{
cout<<p->first<<endl;
}
}
}
return 0;
}
0 comments:
Post a Comment