直接按公式排就可以了。

AC code:

#include <bits/stdc++.h>
using namespace std;

struct Node {
    string name;
    double k;
};

bool cmp(const Node& a, const Node& b) {
    return a.k > b.k;
}

int main() {
    freopen("football.in", "r", stdin);
    freopen("football.out", "w", stdout);
    int T;
    cin >> T;
    while (T--) {
        int a;
        cin >> a;
        vector<Node> Nodes(a);
        for (int i = 0; i < a; i++) {
            string name;
            long long m, n;
            int t;
            cin >> name >> m >> n >> t;
            double k = (0.6 * m + 0.3 * n) * 0.1 * t;
            Nodes[i].name = name, Nodes[i].k = k;
        }
        sort(Nodes.begin(), Nodes.end(), cmp);
        for (int i = 0; i < a; i++) {
            if (i > 0) {
                cout << " ";
            }
            cout << Nodes[i].name;
        }
        cout << endl;
    }
    return 0;
}