IQ Test
시간 제한1초메모리 제한1024 MB
각 질문이 이전 답 중 옵션 t를 고른 개수를 묻고 두 후보 값이 주어질 때, 모순 없이 맞힐 수 있는 질문 수의 최댓값을 구한다.
문제
As a truly clever guy, bobo has never entered any kind of IQ tests. But here comes one.
The test consists of questions, which are numbered conveniently by . Each question has two options -- namely options "A" and "B". The -th question is "How many questions among questions are answered by option ?". ( is either "A" or "B".) Option "A" says there are questions while option "B" says .
bobo soon notices that the test is poorly-designed, so he wonder how many questions he can answer correctly at most.
입력
The first line contains an integer ().
Each of the following lines contains a character and integers ().
출력
A single integer denotes the maximum number of questions he can answer correctly.