#include
#include
#include
#include
using namespace std;
struct data
{
char name[10];
int minute;
int second;
int rnk;
bool inline friend operator < (data a, data b)
{
if (a.minuteelse if (a.minute>b.minute ) return false;
else if (a.secondelse if (a.second>b.second) return false;
else return (strcmp(a.name,b.name)<0?true:false);
}
}student[1000];
int main()
{
int n;
while (scanf("%d",&n),n)
{
for (int i=0;iscanf("%s %d:%d",student[i].name,&student[i].minute,&student[i].second);
sort(student,student+n);
student[0].rnk=1;
for (int i=1;iif (student[i].minute==student[i-1].minute && student[i].second==student[i-1].second)
student[i].rnk=student[i-1].rnk;
else
student[i].rnk=i+1;
for (int i=0;iprintf("%s %d:%02d %d\n",student[i].name,student[i].minute,student[i].second,student[i].rnk);
}
return 0;
}
为啥不把题号贴上……