#abc294f. F - Sugar Water 2

F - Sugar Water 2

Score : 500500 points

问题陈述

高桥和青木分别拥有 NNMM 瓶糖水。
高桥的第 ii 瓶糖水由 AiA_i 克糖和 BiB_i 克水组成。
青木的第 ii 瓶糖水由 CiC_i 克糖和 DiD_i 克水组成。

从高桥和青木的糖水中各选择一瓶进行混合,共有 NMNM 种不同的方式。在这 NMNM 种可能得到的糖水中,找出第 KK 高浓度的糖水中的糖浓度。

这里,由 xx 克糖和 yy 克水组成的糖水的糖浓度计算公式为 100xx+y\dfrac{100x}{x+y} 百分比。我们忽略饱和度的影响。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi and Aoki have NN and MM bottles of sugar water, respectively.
Takahashi's ii-th sugar water is composed of AiA_i grams of sugar and BiB_i grams of water.
Aoki's ii-th sugar water is composed of CiC_i grams of sugar and DiD_i grams of water.
There are NMNM ways to choose one from Takahashi's sugar waters and one from Aoki's and mix them. Among the NMNM sugar waters that can be obtained in this way, find the concentration of sugar in the sugar water with the KK-th highest concentration of sugar.
Here, the concentration of sugar in sugar water composed of xx grams of sugar and yy grams of water is 100xx+y\dfrac{100x}{x+y} percent. We will ignore saturation.

Constraints

  • 1N,M5×1041 \leq N, M \leq 5 \times 10^4
  • 1KN×M1 \leq K \leq N \times M
  • 1Ai,Bi,Ci,Di1051 \leq A_i, B_i, C_i, D_i \leq 10^5
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN MM KK

A1A_1 B1B_1

A2A_2 B2B_2

\vdots

ANA_N BNB_N

C1C_1 D1D_1

C2C_2 D2D_2

\vdots

CMC_M DMD_M

Output

Print the concentration of sugar in the sugar water with the KK-th highest concentration of sugar in percent.
Your output will be considered correct if the absolute or relative error from the true value is at most 10910^{−9}.

Sample Input 1

3 1 1
1 2
4 1
1 4
1 4

Sample Output 1

50.000000000000000

Let (i,j)(i, j) denote the sugar water obtained by mixing Takahashi's ii-th sugar water and Aoki's jj-th.
Below are the sugar waters that can be obtained and their concentrations of sugar.

  • (1,1)(1, 1) : 100×1+1(1+1)+(2+4)=25%100 \times \frac{1 + 1}{(1 + 1) + (2 + 4)} = 25 \%
  • (2,1)(2, 1) : 100×1+4(4+1)+(1+4)=50%100 \times \frac{1 + 4}{(4 + 1) + (1 + 4)} = 50 \%
  • (3,1)(3, 1) : 100×1+1(1+1)+(4+4)=20%100 \times \frac{1 + 1}{(1 + 1) + (4 + 4)} = 20 \%

Among them, the sugar water with the highest concentration of sugar is (2,1)(2, 1), with a concentration of 5050 percent.

Sample Input 2

2 2 2
6 4
10 1
5 8
9 6

Sample Output 2

62.500000000000000

Sample Input 3

4 5 10
5 4
1 6
7 4
9 8
2 2
5 6
6 7
5 3
8 1

Sample Output 3

54.166666666666664

update @ 2024/3/10 12:14:56

}