406804: GYM102562 E Computer Error
Description
John has to stay indoors for a whole month. He is overwhelmed with boredom and decides to purchase a pocket computer. After evaluating several offers, he chooses a Chinese one, as it is the cheapest. A few days later, the computer arrives and John is thrilled to discover that the device has an interesting gaming function.
The game consists of the computer randomly choosing a positive number $$$ \leq 10^9 $$$. The player has to guess the number only by asking the computer several comparisons with a different number specified by the player which will be answered by the computer with $$$True$$$ or $$$False$$$. After a while, John suspects that there must be some contradictions in the computer's answers, realising that some of the answers are wrong. John wants to know which is the smallest possible number of wrong answers given by the computer without knowing the initial number chosen by the computer.
InputThe first line of the input will contain the number $$$T$$$, representing the number of test cases.
The first line of each test will contain one positive number $$$N$$$, the number of questions asked.
The next N lines will contain one character $$$C$$$, one integer $$$X$$$, $$$|X| \leq 10^9$$$, and one string $$$S$$$. The character $$$C$$$ can be either $$$<$$$, $$$>$$$ or $$$=$$$ and $$$S$$$ is either $$$True$$$ or $$$False$$$.
It is guaranteed that the sum of all questions is smaller than 10^6.
OutputThe output file should consist of $$$T$$$ lines, each line containing one integer, the minimum possible number of wrong answers.
Due to the large amount of data in the output, it is recommended to use stream desynchronization, if you are going to write using standard streams in C++.
ExampleInput2 3 = 5 True > 3 True = 1 False 2 > 4 True = 4 TrueOutput
0 1Note
In the first test case, if the number the computer chose is 5, then all the questions are answered correctly, so the answer is 0 wrong answers.
In the second test case, both questions cannot be true at the same time, so then the minimum number of wrong answers is 1.