DVAPRAVCA | 프로그래밍의 벗 PivotOJ
PivotOJ

DVAPRAVCA

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2009 Final Exam #2BOJ 3121

문제

There are points in the plane, some red some blue. The points lived in harmony for years, until the blue points went bonkers and started attacking red points. To protect themselves, the red points decided to erect two parallel lines such that no blue points are contained between the lines. All red points between the lines will be protected by them. Lines may not pass through any points, red or blue. 

The red points observed that, unfortunately, not all of them can be saves in this way. Determine the largest number of red points that can be saved. 

입력

The first line contains an integer N (1 ≤ N ≤ 1000), the number of points in the plane. 

Each of the following N lines contains the coordinates of one point and its colour. Coordinates are pairs of integers less than 109 (one billion) in absolute value; the colour is 'R' or 'B'. 
 
 No three points will be collinear. 

출력

Output the largest number of red points that can be protected by two parallel lines. 

 

예제

예제 1

입력
4
0 0 R
0 1 B
1 1 R
1 0 B
출력
2

예제 2

입력
8
2 -3 R
4 -1 R
-2 0 R
-3 1 B
-2 3 R
1 4 R
2 1 B
0 -3 B
출력
3
코드를 제출하려면 로그인하세요.