#1247
Unrated
KRUMPIRKO
시간 제한
1s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

1 second, 64 MB, 140 points Young Mr. Potato is opening two new stores where he will, you guessed it, sell potatoes. Mr. Potato gets his potatoes from N farmers. Each farmer offers exactly ai potatoes per bag for a total price of ci. Mr. Potato is going to buy all bags of potatoes from all farmers and place the bags in his two stores. Let’s denote the average potato price in the first store with P1, and the average potato price in the second store with P2. The average potato price in a store is equal to the ratio of the price and the total number of potatoes in the store. Taking into account logistical difficulties and the amount of potatoes in the stores, he wants the product of the average prices of potatoes in the stores to be minimal. In other words, he wants the product of P1 and P2 to be minimal. After Mr. Potato settles on a division of bags in the stores, at least one store must have exactly L bags.

입력

The first line of input contains two integers N and L (2 ⩽N ⩽100, 1 ⩽L < N), the number of potato bags and the number of potato bags in at least one store. The second line of input contains N integers ai (1 ⩽ai ⩽100), separated by space. The third line of input contains N integers ci (1 ⩽ci ⩽1 000 000), separated by space. The sum of all ai will be ⩽500.

출력

The first and only line of output must contain the minimal product of P1 and P2 from the task, rounded to three decimal places.

예제 입력 1

3 1
3 2 1
1 2 3

예제 출력 1

0.556

예제 입력 2

3 2
2 2 2
3 3 3

예제 출력 2

2.250
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.