Logo
(追記) (追記ここまで)

31350번 - IQ Test 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB196642.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.

제한

예제 입력 1

2
A 0 1
B 0 1

예제 출력 1

2

예제 입력 2

2
A 1 2
B 0 1

예제 출력 2

1

힌트

출처

Contest > Open Cup > 2014/2015 Season > Stage 10: Grand Prix of China E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /