#include using namespace std; const int N = 310; struct Person { int chinese, math, english; int total; int id; const bool operator<(const Person &b) const { if (total != b.total) return total > b.total; if (chinese != b.chinese) return chinese > b.chinese; return id < b.id; } } person[N]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int chinese, math, english; cin >> chinese >> math >> english; int total = chinese + math + english; person[i] = {chinese, math, english, total, i + 1}; } sort(person, person + n); // 有5名 for (int i = 0; i < 5; i++) printf("%d %d\n", person[i].id, person[i].total); return 0; }