#include <stdlib.h>
#include <stdio.h>
struct node{
Char s[15];
int hour1;
int fen1;
int mia1;
int hour2;
int fen2;
int mia2;
}C[100];
int cmp (const void *a,const void *b)//QSOTRTSortThree-level structure sorting
{
struct node *c= (node *) A;
struct node *d= (node *) b;
if (C->HOUR1!=D->HOUR1) return c->hour1-d->hour1;
else if (C->FEN1!=D->FEN1)
Return c->fen1-d->fen1;
else return c->mia1-d->mia1;
}
int cop (const void *a,const void *b)//qsortSortThree-level structure sorting
{
struct node *c= (node *) A;
struct node *d= (node *) b;
if (C->HOUR2!=D->HOUR2) return d->hour2-c->hour2;
else if (C->FEN2!=D->FEN2)
Return d->fen2-c->fen2;
else return d->mia2-c->mia2;
}
Main ()
{
int n;
scanf ("%d", &n);
while (n--)
{
int m;
scanf ("%d", &m);
Char s1[15],s2[15];
for (int i=0;i
{
scanf ("%s%d:%d:%d%d:%d:%d", C[i].s,&c[i].hour1,&c[i].fen1,&c[i].mia1,&c[i].hour2,&c[i].fen2 , &C[I].MIA2);
}
Qsort (C,m,sizeof (c[0]), CMP);
printf ("%s", C[0].S);
Qsort (C,m,sizeof (c[0]), COP);
printf ("%s\n", C[0].S);
}
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
HDU OJ Door man and closing man