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

10658번 - Learning by Example 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB256625730.645%

문제

Farmer John has been reading all about the exciting field of machine learning, where one can learn interesting and sometimes unexpected patterns by analyzing large data (he has even started calling one of the fields on his farm the "field of machine learning"!). FJ decides to use data about his existing cow herd to build an automatic classifier that can guess whether a cow will have spots or not.

Unfortunately, FJ hasn't been very good at keeping track of data about his cows. For each of his N cows (1 <= N <= 50,000), all he knows is the weight of the cow, and whether the cow has spots. Each of his cows has a distinct weight. Given this data, he builds what is called a "nearest neighbor classifier". To guess whether a new cow C will have spots or not, FJ first finds the cow C' in his herd with weight closest to that of C. If C' has spots, then FJ guesses that C will also have spots; if C' has no spots, FJ guesses the same for C. If there is not one unique nearest neighbor C' but rather a tie between two of FJ's cows, then FJ guesses that C will have spots if one or both these nearest neighbors has spots.

FJ wants to test his new automatic spot predictor on a group of new cows that are just arriving at his farm. After weighing these cows, he sees that the new shipment of cows contains a cow of every integer weight between A and B (inclusive). Please determine how many of these cows will be classified as having spots, using FJ's new classifier. Note that the classifier only makes decisions using data from FJ's N existing cows, not any of the new cows. Also note that since A and B can both be quite large, your program will not likely run fast enough if it loops from A to B counting by ones.

입력

The first line of the input contains three integers N, A, and B (1 <= A <= B <= 1,000,000,000).

The next N lines each describe a single cow. Each line contains either S W, indicating a spotted cow of weight W, or NS W, indicating a non-spotted cow of weight W. Weights are all integers in the range 1 ... 1,000,000,000.

출력

A single integer giving the number of incoming cows that FJ's algorithm will classify as having spots. In the example shown here, the incoming cows of weights 1, 2, 7, 8, 9, and 10 will all be classified as having spots.

제한

예제 입력 1

3 1 10
S 10
NS 4
S 1

예제 출력 1

6

힌트

출처

Olympiad > USA Computing Olympiad > 2014-2015 Season > USACO December 2014 Contest > Bronze 4번

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

출처

대학교 대회

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

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