The 4th(2009) ACM Programming Contest of HUST - Onsite Contest
From: 2009-12-06 12:00:00
To: 2009-12-06 17:00:00
Now: 2017-09-20 01:08:18
A - A Simple Task
Time Limit: 1s
Memory Limit: 128MB
Submissions: 422 Solved: 98
- As is known to all, lots of birds are living in HUST. A bird has s units of food on the first day, and eats k units of food each day. So they must find food in school or they will die. Because food is not that easy to find, birds store it home on the tree. If one bird runs out of food some day, he just dies. (It means that if the bird doesn't have enough food stored and can't find enough food that day, he will die.) A professor is researching on the birds. He has got some records of the birds' everyday life. And you, as his student, are to tell him the birds' state after the last day on the records of the bird.
- The first line is an integer, representing the number of test cases.
In each case, the first line contains one integer n representing the number of records.
The next line contains two integers -- s and k, representing the unit of food on the first day and the number of unit a bird needs each day.
The next n lines, each contains a piece of record. The first word of each record is the name of a bird. You can assume that every bird has a distinct name and the name has no white space. The name has only alphabetical letters, i.e. A-Z and a-z. The following two integers is the date and the unit of food that the bird found on that day.
(1<= n <=100000, the other integers are all greater than or equal to 1 and less than or equal to 10000.)
Hint: the date of records may be disordered, but a bird's name will only appear once on each day. And the bird's name may appear even if he died before, so you can assume its the error in the records and just ignore it.
- Output "Case #t:" before each test case on a single line.
For each test case, print out the name of all the birds and his food store, each bird a line. The output should be in alphabet order.
If a bird died some day, you just tell the professor the bird was dead. The format is as the sample output.
And you should check sample output for details.
Output a blank line after each case.
- Sample Input
Gaewah 4 3
Gaewah 10 5
Gaewah 100 1
Smith 1 3
peterpan 7 3
Oxford 3 5
Scheme 2 100
Regexp 1 10
- Sample Output
- Xie Song