1 solutions

  • 0
    @ 2026-11-16 11:24:49

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    struct node {
        int ans;
        string name;
    }a[1005];
    bool com(struct node a,struct node b) {
        return a.ans > b.ans;
    }
    int main() {
        int n,b,c,d,e;
        cin>>n;
        for(int i = 0 ; i < n;i++) {
            cin>>a[i].name>>b>>c>>d>>e;
            a[i].ans = b+c+d+e;
        }
        sort(a,a+n,com);
        for(int i = 0 ; i < 3; i++)
            cout<<a[i].name<<endl;
        return 0;
    }
    
    • 1

    Information

    ID
    259
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By