A-组队分配_2020 年第一届辽宁省大学生程序设计竞赛 (nowcoder.com)https://ac.nowcoder.com/acm/contest/8440/A
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,string> PII;
int main()
{
int t, n;
string x;
int rank;
cin >> t;
while(t --)
{
vector<PII> v;
cin >> n;
int n2 = 3*n;
for(int i = 0; i < n2; i++){
cin >> x >> rank;
v.push_back({rank, x});
}
sort(v.begin(), v.end());
for(int i = 0; i < n2; i+=3)
{
cout<<"ACM-"<<i/3<<' '<<v[i+2].second<<' '<<v[i+1].second<<' '<< v[i].second;
cout << endl;
}
}
return 0;
}