此题做法和人口普查一样
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main() {
char name[16],max_name[16],min_name[16];
int hour, minute, second;
int n;
int maxtime = 246060, mintime = 000000;
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%s", name);
for(int j=0;j<2;j++){
scanf("%d:%d:%d",&hour, &minute, &second);
int x = hour * 10000 + minute * 100 + second;
if (x < maxtime) {
maxtime = x;
strcpy(max_name, name);
}
if (x > mintime) {
mintime = x;
strcpy(min_name, name);
}
}
}
cout << max_name<<" " << min_name;
return 0;
}