#P3324. [SDOI2015] 星际战争

    ID: 2373 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2015二分网络流山东Special Judge最大流

[SDOI2015] 星际战争

Description

In the year 33333333, on a certain planet in the Milky Way, the X Legion and the Y Legion are fighting fiercely.

At a certain stage of the battle, the Y Legion sends NN giant robots to attack the X Legion’s position. The ii-th giant robot has an armor value of AiA_i. When a robot’s armor value drops to 00 or below, the robot is destroyed.

The X Legion has MM laser weapons. The ii-th laser weapon can reduce the armor of a single giant robot by BiB_i per second. The laser weapons’ attacks are continuous over time.

These laser weapons are peculiar: each weapon can attack only certain designated enemies. Seeing their robots being destroyed one after another, the Y Legion urgently needs to issue more commands.

To this end, the Y Legion needs to know the minimum time the X Legion requires to destroy all of the Y Legion’s giant robots. However, they cannot compute this themselves, so they ask you for help.

Input Format

The first line contains two integers, N,MN, M.

The second line contains NN integers, A1,A2ANA_1, A_2 \cdots A_N.

The third line contains MM integers, B1,B2BMB_1, B_2 \cdots B_M.

Each of the next MM lines contains NN integers, each being 00 or 11. In this part, the jj-th integer of the ii-th line is 00 if the ii-th laser weapon cannot attack the jj-th giant robot, and 11 if it can.

Output Format

Output a single real number: the minimum time required for the X Legion to destroy all of the Y Legion’s giant robots. Answers with an absolute error not exceeding 10310^{-3} are accepted.

2 2
3 10
4 6
0 1
1 1
1.300000

Hint

  • Sample Explanation 1:

For the first 0.50.5 seconds, laser weapon 11 attacks robot 22, and laser weapon 22 attacks robot 11. Robot 11 is completely destroyed; robot 22 has 88 armor remaining.

For the next 0.80.8 seconds, laser weapons 11 and 22 attack robot 22 simultaneously. Robot 22 is completely destroyed.

  • Constraints:

For all testdata, 1N,M501 \le N, M \le 50, 1Ai1051 \le A_i \le 10^5, 1Bi10001 \le B_i \le 1000, and the input guarantees that the X Legion can destroy all of the Y Legion’s giant robots.

Translated by ChatGPT 5