#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
struct Node{
char id[20];
int hh,mm,ss;
}temp,ansCome,ansLeave;
bool later(Node node1,Node node2){
if(node1.hh!=node2.hh) return node1.hh>node2.hh;
else if(node1.mm!=node2.mm) return node1.mm>node2.mm;
else return node1.ss>node2.ss;
}
int main(){
int n;
scanf("%d",&n);
ansCome.hh=24,ansCome.mm=60,ansCome.ss=60;
ansLeave.hh=0,ansLeave.mm=0,ansLeave.ss=0;
for(int i=0;i<n;i++){
scanf("%s %d:%d:%d",temp.id,&temp.hh,&temp.mm,&temp.ss);
if(later(temp,ansCome)==false) ansCome=temp;
scanf("%d:%d:%d",&temp.hh,&temp.mm,&temp.ss);
if(later(temp,ansLeave)==true) ansLeave=temp;
}
printf("%s %s\n",ansCome.id,ansLeave.id);
return 0;
}
1006
最新推荐文章于 2024-01-03 10:49:44 发布