| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 19 | 6 | 6 | 42.857% |
As a truly clever guy, bobo has never entered any kind of IQ tests. But here comes one.
The test consists of $n$ questions, which are numbered conveniently by 1,ドル 2, \dots, n$. Each question has two options -- namely options "A" and "B". The $i$-th question is "How many questions among questions 1,ドル 2, \dots, (i - 1)$ are answered by option $t_i$?". ($t_i$ is either "A" or "B".) Option "A" says there are $x_i$ questions while option "B" says $y_i$.
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 $n$ (1ドル \leq n \leq 200000$).
Each of the following $n$ lines contains a character $t_i$ and 2ドル$ integers $x_i, y_i$ ($t_i \in \{A, B\}, 0 \leq x_i, y_i \leq n$).
A single integer denotes the maximum number of questions he can answer correctly.
2 A 0 1 B 0 1
2
2 A 1 2 B 0 1
1