Advertisement
cd62131

Sports Meet

Feb 6th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5. class Team {
  6. public:
  7.   long long int name;
  8.   int min[4], sec[4], sum = 0;
  9.   bool operator()(const Team& t1, const Team& t2) const {
  10.     return t1.sum < t2.sum;
  11.   }
  12. };
  13.  
  14. int main() {
  15.   do {
  16.     int n;
  17.     cin >> n;
  18.     if (n == 0) break;
  19.     vector<Team> teams;
  20.     for (int i = 0; i < n; i++) {
  21.       Team t;
  22.       cin >> t.name;
  23.       t.sum = 0;
  24.       for (int j = 0; j < 4; j++) {
  25.         cin >> t.min[j] >> t.sec[j];
  26.         t.sum += t.min[j] * 60 + t.sec[j];
  27.       }
  28.       teams.push_back(t);
  29.     }
  30.     sort(teams.begin(), teams.end(), Team());
  31.     cout << teams.at(0).name << endl;
  32.     cout << teams.at(1).name << endl;
  33.     cout << teams.at(n - 2).name << endl;
  34.   }
  35.   while (1);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement