66 solutions

  • -6
    @ 2025-6-7 11:28:53

    #include<bits/stdc++.h> using namespace std; const int N=1001; struct Student { int name; double sc; }s[N]; bool cmp(Student a,Student b) { if(a.sc>b.sc) return 1; if(a.sc==b.sc&&a.name<b.name) return 1; return 0; } int main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) { cin>>s[i].name>>s[i].sc; } sort(s+1,s+n+1,cmp); cout<<s[m].name<<" "<<s[m].sc; }

    Information

    ID
    838
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    2
    Tags
    # Submissions
    757
    Accepted
    130
    Uploaded By