Description
MM, a slashie, is an expert in many different realms. One of his skills is having great creation.
Today, he comes up with a good idea for an app, called ‘OFfood’.
‘OFfood’ is an abbreviation of ‘on-floor food’(在地美食). It is an app recording information about on-floor food. Users can report the on-floor food they see or check where are the on-floor foods and their condition. In particular, there is some information for the food: type, name, fly, and position.
- type: There are only 2 types of food: fruit and meat.
- name: Each food has its unique name, which is a string containing only English letters.
- fly: There would be some flies on the food. For the food on the floor, the flies would add by 4 every 5 minutes for fruit, and add by 5 every 5 minutes for meat.
- position: The position would only be either floor, stomach, or trash can.
There are 4 types of operations that users may perform:
- report n k: The user report that they see an on-floor food, which its name is n and the type is k, with no fly.
- eat n k: Someone eats the food on the floor with name n, type k. The food n then changes its position to ‘stomach’.
- throw n k: Someone throws the food on the floor with name n and type k, into the trash can. The food n then changes its position into ‘trashcan’.
- mix n m k1 k2: Someone mix the food with name n, type k1 with the food with name m, type k2. The food m still remains its condition, while the food n is mixed with food m and its type remains the same. The mixed food would have a new name s, which s is the concatenate of m and n. The amount of flies is the sum of the fly of the two food. It is guaranteed that the two foods are on the floor when mixed.
MM now collects the operations that users made. He wants to know some information about the foods:
- How many people are sick because they eat rotten food. People would definitely get sick if they ate rotten food. The fruit is rotten if they have more than(>=) 10 flies on it, and the meat is rotten if they have more than(>=) 20 flies on it. What's more, each rotten food would surely be eaten by different people since people who eat rotten food would be sent to the hospital immediately.
- How much food is still on the floor.
- The food’s name list, sorted by lexicographical order, which the food is still on the floor.
Since you are a code farmer(碼農), help him to collect the data he wants.
You only have to finish the function defined in the header file.
Input
The first line contains an integer t, which means MM collects the information for 5 * t minutes.
Then, there are t parts of operations, each part is separated by 5 minutes intervals.
For every part, the first line contains an integer n, representing the number of operations in this part.
The following n lines, each represent an operation, following the format in the description.
Constrains:
1 <= t <= 40
1 <= n <= 10
number of fruit <= 100
number of meat <= 100
Output
The first line contains an integer, representing the number of sick people.
The second line contains an integer, representing the amount of food still on the floor.
The following n lines, each contain a string, representing a food’s name. The foods are sorted by lexicographical order.
Partial Judge Code
13878.cpp
Partial Judge Header
13878.h
Tags