Description
There are some animals consisting of cats, fish, birds, and humans in a beautiful world.
Whenever an animal's HP turns into 0 or negative, it becomes dead and you should print "<its name> dead" right away.
You have to perform the following operations:
- Birth <name> <species>
- An animal with name <name>, species <species>, and HP 10 is born.
- Print "<name> birth" right away.
- (Note that the animals will be numbered by the order they are born.)
- Birthsick <name> <species> <HP>
- An animal with name <name>, species <species>, and HP <HP> is born.
- Print "<name> birth" right away.
- It is guaranteed that <HP> is positive and not more than 10.
- (Note that the animals will be numbered by the order they are born.)
- Infromation <i>
- If the i-th animal is alive, print its name, species, and HP.
- Talk <i>
- If the i-th animal is alive and
- cat, print "Meow".
- fish, print "?".
- bird, print "Suba".
- human, print "Hello, world".
- Sleep <i> <x>
- If the i-th animal is alive and its HP is less than or equal to 100, multiply its HP by x.
- (Note that its HP may become larger than 100 after this operation.)
- Work <i> <x>
- If the i-th animal is alive, decrease its HP by x.
- (Note that it may become dead after this operation.)
- Eat <i> <j>
- If the i-th animal and the j-th animal are both alive and
- if the i-th animal is cat and the j-th animal is fish,
- or the i-th animal is bird and the j-th animal is fish,
- or the i-th animal is human and the j-th animal is fish or bird,
- then increase the HP of the i-th animal by the HP of the j-th animal
- and turn the HP of the j-th animal into 0 (which means the j-th animal dies).
- If the i-th animal is human and the j-th animal is cat,
- then turn the HP of the i-th animal into 0 (which means the i-th animal dies).
- Otherwise, do nothing.
- Eatfood <i> <x>
- If the i-th animal is alive, increase the HP of the i-th animal by <x>.
- Kill <i> <j>
- If i ≠ j and the i-th animal and the j-th animal are both alive and of the same kind
- then turn the HP of the j-th animal into 0 (which means the j-th animal dies).
(Note that Birth and Birthsick share the same method name in function.h.)
(Note that Eat and Eatfood share the same method name in function.h.)
Input
The first line of the input contains a number Q — the number of operations.
The next Q lines is one of the operations described in the statement.
Q ≤ 400000
1 ≤ x ≤ 10 in operation Sleep, Work, and Eatfood.
The time limit is 3sec.
- In test 1 and 2, the operations consists of Birth and Informatoin.
- In test 3 and 4, the operations consists of Birth, Information, Talk, Sleep, Work, and Eat.
- In test 5 and 6, the operations consists of Birth, Birthsick, Information, Talk, Sleep, Work, Eat, Eatfood, and Kill.
Animals may die in test 3, 4, 5, and 6.
Output
Whenever there's an operation "Birth <name> <species>", print "<name> birth".
Whenever there's an operation "Birth <name> <species> <HP>", print "<name> birth".
Whenever there's an operation "Infromation <i>", print the name, species and HP of the i-th animal.
Whenever there's an operation "Talk <i>", print the corresponding sentences according to the problem statement.
Whenever an animal becomes dead, print "<its name> dead".
Remember to print '\n' at the end of each line.
Partial Judge Code
13480.cpp
Partial Judge Header
13480.h
Tags