Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <map>
- #include <vector>
- using namespace std;
- struct Student
- {
- string first, last; int a;
- };
- int main() {
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- int n;
- fin >> n;
- map<int, vector<Student>> M;
- for (int i = 0; i < n; i++) {
- Student cur;
- fin >> cur.last >> cur.first >> cur.a;
- M[-cur.a].push_back(cur);
- }
- fout << -(*M.begin()).first << endl;
- fout << (*M.begin()).second.size() << endl;
- for (Student cur : (*M.begin()).second) {
- fout << cur.last << " " << cur.first << endl;
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment