| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 85561 | sh25_huangse | 期中考试成绩排序 | C++ | Accepted | 0 MS | 252 KB | 637 | 2026-03-13 15:43:31 |
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct Student { string name; int score; }; bool compare(const Student& a, const Student& b) { if (a.score != b.score) return a.score > b.score; return a.name < b.name; } int main() { int n; cin >> n; vector<Student> students(n); for (int i = 0; i < n; ++i) { cin >> students[i].name >> students[i].score; } sort(students.begin(), students.end(), compare); for (const auto& student : students) { cout << student.name << " " << student.score << endl; } return 0; }