Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- typedef unsigned long long int ull;
- typedef vector<int> vi;
- typedef vector<ll> vll;
- typedef vector<vi> vvi;
- typedef pair<int,int > pii;
- typedef vector< pii > vpii;
- typedef set<int> sti;
- #define sc scanf
- #define pf printf
- #define sci(n) scanf("%d",&n)
- #define scl(n) scanf("%lld",&n)
- #define scf(n) scanf("%lf",&n)
- #define scs(s) scanf("%s",s)
- #define pfi(n) printf("%d",n)
- #define pfl(n) printf("%lld",n)
- #define pff(n) cout<<n
- #define line printf("\n")
- #define spc printf(" ")
- #define loop(i,x,y) for(int i=int(x); i<=int(y); i++)
- #define rloop(i,y,x) for(int i=int(y); i>=int(x); i--)
- #define cspf(i) printf("Case %d:", i)
- #define pb push_back
- #define mp make_pair
- #define ff first
- #define ss second
- #define all(v) v.begin(),v.end()
- #define rall(v) v.rbegin(),v.rend()
- #define read() freopen("input.txt", "r", stdin)
- #define write() freopen("output.txt", "w", stdout)
- /// Constants
- #define eps 1e-9
- #define PI acos(-1.0) // 3.1415926535897932
- int main()
- {
- read();
- write();
- int n; sci(n);
- loop(j,1,n){
- vector< pair< pair<int,int>, string > > player(10);
- int x,y;
- string nm;
- loop(i,0,9){
- cin>>nm;
- player[i].second=nm;
- cin>>x>>y;
- player[i].first.first=x;
- player[i].first.second=y;
- }
- sort(player.rbegin(),player.rend());
- int k=5;
- rloop(i,4,0){
- if(player[5].first.first==player[i].first.first)
- k=i;
- else
- break;
- }
- int l=4;
- loop(i,5,9){
- if(player[4].first.first==player[i].first.first)
- l=i;
- else
- break;
- }
- if(l>=k)
- sort(player.begin()+k,player.begin()+(l+1));
- vector<string>attck,diff;
- loop(i,0,4){
- attck.push_back(player[i].second);
- }
- loop(i,5,9){
- diff.push_back(player[i].second);
- }
- sort(all(attck));
- sort(all(diff));
- cspf(j);
- line;
- pf("(");
- loop(i,0,4){
- cout<<attck[i];
- if(i<4) pf(", ");
- }
- pf(")\n(");
- loop(i,0,4){
- cout<<diff[i];
- if(i<4) pf(", ");
- }
- pf(")\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement