12015

#include <iostream>
#include <map>
#include <vector>
#include <string>

using namespace std;

int mx=1000000000;

int main()
{
    int t,kase=1,num;
    string str;
    vector<string> vb;
    cin>>t;

    while(t--)
    {
        mx=1000000000;
        vb.clear();
        for(int i=0;i<10;i++)
        {
           cin>>str;
           cin>>num;

           if(num<mx)
           {
              if(vb.size()==0)
              {
                 vb.push_back(str);
                 mx=num;
              }
           }
           else if(num==mx)
           {
               vb.push_back(str);
           }
           else if(num>mx)
           {
                vb.clear();
                mx=num;
                vb.push_back(str);
           }
        }
        cout<<"Case #"<<kase++<<":\n";
        for(int i=0;i<vb.size();i++)
                cout<<vb[i]<<"\n";
    }
    return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *