1 solutions
-
0
Guest MOD
-
0
#include <iostream> #include <vector> #include <algorithm> #include <string> 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; } else { 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& s : students) { cout << s.name << " " << s.score << endl; } return 0; }
- 1
Information
- ID
- 1173
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 25
- Accepted
- 7
- Uploaded By