F.cpp 656 B

123456789101112131415161718192021222324252627282930
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. struct PPP {
  4. string name;
  5. int A, B, C;
  6. bool operator<(const PPP &that) const {
  7. if (A - that.A)return A < that.A;
  8. if (B - that.B)return B < that.B;
  9. if (C - that.C)return C < that.C;
  10. return name < that.name;
  11. }
  12. };
  13. int main() {
  14. int n;
  15. while (cin >> n) {
  16. PPP N[n];
  17. for (int i = 0; i < n; i++) {
  18. cin >> N[i].name >> N[i].A >> N[i].B >> N[i].C;
  19. }
  20. PPP *mp = min_element(N, N + n);
  21. cout << mp->name << " " << mp->A << " " << mp->B << " " << mp->C << endl;
  22. }
  23. return 0;
  24. }