#include<bits/stdc++.h>
using namespace std;
struct A
{
long a1,b1;
string s1;
bool operator < (const A &b) const
{
if(a1==b.a1)
{
if(b1==b.b1) return s1<b.s1;
else
return b1<b.b1;
}
else
return a1>b.a1;
}
};
main()
{
long ts,cs=1;
cin>>ts;
while(ts--)
{
long i,a,b;
string s;
vector<A>vb;
vector<string>vb1,vb2;
set<string>ss1,ss2;
A stk;
for(i=0; i<10; i++)
{
cin>>s>>a>>b;
stk.s1=s;
stk.a1=a;
stk.b1=b;
vb.push_back(stk);
}
sort(vb.begin(),vb.end());
for(i=0;i<5;i++)
{
vb1.push_back(vb[i].s1);
}
for(i=5;i<10;i++)
{
vb2.push_back(vb[i].s1);
}
sort(vb1.begin(),vb1.end());
sort(vb2.begin(),vb2.end());
printf("Case %ld:\n",cs++);
cout<<"(";
for(i=0;i<vb1.size()-1;i++)
{
cout<<vb1[i]<<", ";
}
cout<<vb1[4]<<")"<<endl;
cout<<"(";
for(i=0;i<vb2.size()-1;i++)
{
cout<<vb2[i]<<", ";
}
cout<<vb2[4]<<")"<<endl;
}
}
using namespace std;
struct A
{
long a1,b1;
string s1;
bool operator < (const A &b) const
{
if(a1==b.a1)
{
if(b1==b.b1) return s1<b.s1;
else
return b1<b.b1;
}
else
return a1>b.a1;
}
};
main()
{
long ts,cs=1;
cin>>ts;
while(ts--)
{
long i,a,b;
string s;
vector<A>vb;
vector<string>vb1,vb2;
set<string>ss1,ss2;
A stk;
for(i=0; i<10; i++)
{
cin>>s>>a>>b;
stk.s1=s;
stk.a1=a;
stk.b1=b;
vb.push_back(stk);
}
sort(vb.begin(),vb.end());
for(i=0;i<5;i++)
{
vb1.push_back(vb[i].s1);
}
for(i=5;i<10;i++)
{
vb2.push_back(vb[i].s1);
}
sort(vb1.begin(),vb1.end());
sort(vb2.begin(),vb2.end());
printf("Case %ld:\n",cs++);
cout<<"(";
for(i=0;i<vb1.size()-1;i++)
{
cout<<vb1[i]<<", ";
}
cout<<vb1[4]<<")"<<endl;
cout<<"(";
for(i=0;i<vb2.size()-1;i++)
{
cout<<vb2[i]<<", ";
}
cout<<vb2[4]<<")"<<endl;
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন