PDF题面:
百度网盘 请输入提取码 提取码: kcdr
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl '\n'
void GordenGhost();
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
int t;
cin>>t;
while(t--)
GordenGhost();
return 0;
}
void GordenGhost(){
int n;
cin>>n;
vector<pair<int,int>>w(n);
for(int i=0;i<n;i++){
int a,b,c,d;
cin>>a>>b>>c;
d=a*9+b*3+c;
w[i]={i+1,d};
}
stable_sort(w.begin(),w.end(),[&](auto a,auto b){
return a.second>b.second;
});
for (int i=0;i<n;i++) cout<<w[i].first<<' ';
cout<<'\n';
}