#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
struct person
{
char id[20];
int hh,mm,ss;
}temp,early,last;
bool cmp(person a,person b)
{
if(a.hh!=b.hh)
return a.hh>b.hh;
if(a.mm!=b.mm)
return a.mm>b.mm;
if(a.ss!=b.ss)
return a.ss>b.ss;
}
int main()
{
int n;
scanf("%d",&n);
early.hh=24,early.mm=60,early.ss=60;
last.hh=0;last.mm=0,last.ss=0;
for(int i=0;i<n;i++)
{
scanf("%s %d:%d:%d",temp.id,&temp.hh,&temp.mm,&temp.ss);
if(cmp(temp,early)=false)
early=temp;
scanf("%d:%d:%d",&temp.hh,&temp.mm,&temp.ss)
if(cmp(temp,last))
last=temp;
}
printf("%s %s\n",early.id,last.id);
return 0;
}
A1006
最新推荐文章于 2020-05-03 23:35:35 发布