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

18487번 - Eleven Problems 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB31121055.556%

문제

You have prepared a very nice contest with n problems. This contest has already been used at two training camps. After each camp, you ran a quick poll asking the contestants which problem they liked the most. At the i-th camp, ai,j contestants voted for problem j.

You are going to build two pie charts based on this data, one for each training camp. Recall that a pie chart is a circular statistical graphic, which is divided into slices to illustrate numerical proportion. In a pie chart, the arc length of each slice (and consequently its central angle and area) is proportional to the quantity it represents.

Both pie charts must have the same radius and consist of exactly n slices, one for each problem, and each slice must be a single circular sector. The area of slice i must be proportional to the number of votes for problem i at the corresponding training camp. The rotation and the order of the slices can be arbitrary and different for the two pie charts.

You want the resulting pie charts to look as similar as possible. To have an objective criterion, you define the similarity of two pie charts as follows. Suppose that the slices corresponding to problem i are colored into color i. Place one pie chart over the other one so that their boundaries match. The similarity of the pie charts is the ratio of the area of the pie charts colored into the same color to the overall pie chart area. Note that the similarity of the pie charts is independent of their radius.

Find a way to draw the pie charts to maximize their similarity.

입력

The first line of the input contains an integer n (2 ≤ n ≤ 11), denoting the number of problems.

Each of the following n lines contains two integers a1,j and a2,j (1 ≤ ai,j ≤ 106), denoting the number of votes for the j-th problem at the first and the second training camps.

출력

Display the maximum possible similarity of the pie charts. Your answer must be correct to within an absolute error of 10−9.

제한

예제 입력 1

2
3 2
2 2

예제 출력 1

0.9

예제 입력 2

4
3 7
21 2
4 5
2 6

예제 출력 2

0.333333333333333

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 5: Gennady Korotkevich Contest 4 K번

Contest > Open Cup > 2018/2019 Season > Stage 11: Grand Prix of Gomel K번

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

출처

대학교 대회

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

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