#include<bits/stdc++.h> using namespace std; struct Student { string name; int score; }; bool cmp(Student a, Student b) { if(a.score != b.score) return a.score > b.score; return a.name < b.name; } int main() { int n; cin >> n; vector students(n); for(int i=0; i<n; i++) { cin >> students[i].name >> students[i].score; } sort(students.begin(), students.end(), cmp); for(auto s : students) { cout << s.name << " " << s.score << endl; } return 0; }

2 条评论

  • @ 2025-7-16 13:28:49
    • [ ] `
    | 
    | 
    $$
    Column 
    $$
    | | | | | |
    | - | - | - | - | - | - |
    | | | | | | |
    | | | | | | |
    | | | | | | |
    | | | | | | |
    | | |
    | - | - | - |
    | | | |
    | | | |
    
    1. - > ###### 才怪<u>*~~****~~*</u>
    

    `

    • @ 2025-7-10 14:55:20
      • 1

      信息

      ID
      182
      时间
      ms
      内存
      MiB
      难度
      7
      标签
      递交数
      99
      已通过
      23
      上传者