Neutral Spectator
시간 제한2초메모리 제한2048 MB
길이 x와 y인 연속 구간을 각각 골랐을 때 모든 교차 쌍의 (공격 합)/(방어 합) 비율의 최솟값을 최대화하는 값을 각 질의마다 구한다.
문제
The battle of the mages continues! Today Svetozar has gathered a team of good mages, while Arglwyddytywyllwch has assembled a team of evil mages.
Each mage has the ability to attack by casting spells and the ability to defend against the spells of other mages, expressed as certain numbers. The outcome of the battle and its spectacle depend on these abilities. The -th good mage has the attack ability and the defense ability ; the -th evil mage has the attack ability and the defense ability .
Before the battle begins, Svetozar and Arglwyddytywyllwch will choose several consecutive mages from their teams (that is, if -th and -th mages are chosen in a team, then mages from the same team are also chosen). Only the chosen mages from each team will fight.
You are an unbiased, neutral spectator, and you are not very concerned about which side will win. You are more interested in the spectacle. You will be dissatisfied if at least one pair of mages from different teams does not fight intensely enough. You define the intensity of the battle between the -th good mage and the -th evil mage as the ratio of the sum of their attack abilities to the sum of their defense abilities, that is,
You define the intensity of the entire battle between the good mages with indices from to () and the evil mages with indices from to () as the minimum intensity of the battle among all pairs of chosen mages from different teams, that is, as
Before the battle begins, you have considered hypothetical situations: given that exactly good mages and exactly evil mages will be chosen, what is the maximum possible intensity of the upcoming battle?
입력
The first line contains a single integer (), denoting the number of test cases.
Then descriptions of test cases follow. The first line of each description contains three integers , , (): the number of mages in Svetozar's team, the number of mages in Arglwyddytywyllwch's team, and the number of hypothetical situations.
The second line contains integers : the abilities of the good mages to attack.
The third line contains integers : the abilities of the good mages to defend.
The fourth line contains integers : the abilities of the evil mages to attack.
The fifth line contains integers : the abilities of the evil mages to defend.
Each of the following lines contains two integers and (, ): the number of chosen good mages and the number of chosen evil mages in a hypothetical situation.
It is guaranteed that for , . It is also guaranteed that the sum of all values over all test cases does not exceed .
출력
For each test case, output lines. Each line should contain a single real number: maximum possible intensity of the corresponding battle. The answer will be considered correct if its absolute or relative error does not exceed .
힌트
The intensities of battles between the good mages and each of the evil mages in the first test case are:
for the first good mage: , , , ;
for the second good mage: , , , ;
for the third good mage: , , , .
In the second test case, there are only two mages, and the intensity of their battle is .