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

3766번 - Sherlock Holmes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB5000.000%

문제

Sherlock Holmes, the well known detective, must solve a puzzling situation. He has n boxes B1, B2, .., Bn, where n is even, each containing m balls. The balls are white and black. Let Bi = (Wi, Bi) denote a box with Wi white balls and Bi black balls. He must partition the boxes into two sets, each consisting of n/2 boxes, such that either the white balls or the black balls hold a majority in both sets. If there is such a majority, let m1 and m2 denote the percentage of the majority balls in each set. Holmes must find very quickly the maximum possible value of min(m1, m2). Can you help Holmes?

입력

Each data set in the file stands for a particular set of boxes. A data set starts with the number n (n < 10000) of boxes. Follows the number m (m < 10000) of balls, and for each box the number (< 10000) of white and black balls in this specific order. The program prints the color (W or B) of the balls that hold the majority followed by the maximum value - if there is such a majority, or No solution if no majority can be obtained. White spaces can occur freely in the input. The input data are correct and terminate with an end of file.

출력

For each set of data the program prints the result to the standard output from the beginning of a line.

제한

예제 입력 1

4
30
17 13
12 18
20 10
14 16

예제 출력 1

W 51.67

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2006 D번

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

출처

대학교 대회

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

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