| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 77718 | sh25_wangtaojie | 跳绳比赛 | C++ | Accepted | 0 MS | 252 KB | 755 | 2025-12-26 14:42:40 |
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct Student { int score; int originalIndex; }; bool compare(const Student& a, const Student& b) { return a.score > b.score; } int main() { int n = 5; vector<int> scores(n); vector<Student> students(n); for (int i = 0; i < n; ++i) { cin >> scores[i]; students[i] = {scores[i], i}; } sort(students.begin(), students.end(), compare); vector<int> ranks(n); for (int i = 0; i < n; ++i) { ranks[students[i].originalIndex] = i + 1; } // 输出结果 for (int i = 0; i < n; ++i) { cout << scores[i] << "--" << ranks[i] << endl; } return 0; }