#P15959. [ICPC 2018 Jakarta R] Lie Detector
[ICPC 2018 Jakarta R] Lie Detector
题目描述
Andi is a young and prominent detective in the police force. His ability to track down criminals, uncover the truth, and solve cases never ceases to amaze all of his colleagues. One day, he is faced with a suspicious eyewitness testimony when working on a certain case. In usual cases, Andi simply ignores such unreliable testimony; however, in this case, the eyewitness testimony is too important to be ignored. To resolve this situation, Andi has to rely on technology, i.e. using a lie detector.
Andi proceeds to use a lie detector to detect whether the eyewitness testimony is true. However, Andi notices that the lie detector he used might have been tampered, thus, he employs a second lie detector to detect whether the first lie detector’s result is correct. This situation happens repeatedly such that Andi ends up employing lie detectors in total. The lie detector reports the truth of the lie detector for , and the lie detector reports the truth of the eyewitness testimony.
In the end, Andi knows that the last () lie detector has not been tampered and always report the truth correctly. Now, he needs to determine whether the eyewitness testimony is true given the result of all lie detectors.
For example, let and the lie detectors result are (LIE, LIE, TRUTH, TRUTH).
- The lie detector reports that the lie detector is TRUTH. As the lie detector always report the truth correctly, then the lie detector’s result is correct as it is.
- The lie detector reports that the lie detector is TRUTH. As the lie detector’s result is correct as it is, then the lie detector’s result is also correct as it is.
- The lie detector reports that the lie detector is LIE. As the lie detector’s result is correct as it is, then the lie detector’s result is wrong.
- The lie detector reports that the eyewitness testimony is LIE. As the lie detector’s result is wrong, then the eyewitness testimony is correct; in other words, what the eyewitness says is true.
Therefore, the eyewitness testimony in this example is true.
输入格式
Input begins with a line containing an integer (). The next lines, each contains a string (either TRUTH or LIE) representing the output of the lie detector for respectively.
输出格式
Output contains a string TRUTH or LIE in a line whether the eyewitness testimony is true or false.
4
LIE
LIE
TRUTH
TRUTH
TRUTH
3
LIE
LIE
LIE
LIE
提示
Explanation for the sample input/output #1
This sample is illustrated in the problem description above.