Raslboyy

Untitled

Sep 4th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <map>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. struct Student
  9. {
  10.     string first, last; int a;
  11. };
  12.  
  13. int main() {
  14.     ifstream fin("input.txt");
  15.     ofstream fout("output.txt");
  16.  
  17.     int n;
  18.     fin >> n;
  19.     map<int, vector<Student>> M;
  20.     for (int i = 0; i < n; i++) {
  21.         Student cur;
  22.         fin >> cur.last >> cur.first >> cur.a;
  23.         M[-cur.a].push_back(cur);
  24.     }
  25.     fout << -(*M.begin()).first << endl;
  26.     fout << (*M.begin()).second.size() << endl;
  27.     for (Student cur : (*M.begin()).second) {
  28.         fout << cur.last << " " << cur.first << endl;
  29.     }
  30.  
  31.     fin.close();
  32.     fout.close();
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment