|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||4||3||3||75.000%|
The zombies have cornered you and your team. There’s no hope...
But wait! Suddenly, they all stop advancing and offer you a deal instead. As it turns out, the zombies are having a problem finding good tasting brains, which, to a zombie, are the smart brains (there is nothing more disgusting to a zombie than the brains of a communications major). While your brains would be really delicious, the zombies realize that they could be put to better use by helping them to find other smart brains. The deal is this: help the zombies determine whether a given brain is smart (and therefore tasty) or not, and they will let your team go (at least for now).
Being the big-brained team that you are, you quickly discover that brains can be determined to be smart or not if the brain can return a correct answer to a given Boolean expression. You quickly compile a list of Boolean expressions together and set off testing one expression on each brain.
Every Boolean expression is deterministic and is recursively defined as follows
There are no characters in the expression other than what’s listed below. Here is each character’s definition:
The first line contains an integer x such that 0 < x ≤ 10000. This is followed by x lines each containing a complete Boolean expression (up to 50 characters long) followed by one space, the equals symbol ‘=’, another space, and the test brain’s evaluation of the expression (either ‘t’ or ‘f’).
On one line for each test brain, print the number of the brain followed by a colon and a space followed by either “Good brain” if the expression was evaluated correctly or “Bad brain” if the expression was not evaluated correctly. Once you are finished, I suggest you start running as fast as you can, as the zombies will only give you so much of a head start for your help.
4 (t|f) = f ((t|f)&((f|t)&f)) = f ((f&f)|(f|!(t&f))) = t (f|(f|t)) = f
1: Bad brain 2: Good brain 3: Good brain 4: Bad brain