#P3324. [SDOI2015] 星际战争
[SDOI2015] 星际战争
Description
In the year , 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 giant robots to attack the X Legion’s position. The -th giant robot has an armor value of . When a robot’s armor value drops to or below, the robot is destroyed.
The X Legion has laser weapons. The -th laser weapon can reduce the armor of a single giant robot by 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, .
The second line contains integers, .
The third line contains integers, .
Each of the next lines contains integers, each being or . In this part, the -th integer of the -th line is if the -th laser weapon cannot attack the -th giant robot, and 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 are accepted.
2 2
3 10
4 6
0 1
1 1
1.300000
Hint
- Sample Explanation 1:
For the first seconds, laser weapon attacks robot , and laser weapon attacks robot . Robot is completely destroyed; robot has armor remaining.
For the next seconds, laser weapons and attack robot simultaneously. Robot is completely destroyed.
- Constraints:
For all testdata, , , , and the input guarantees that the X Legion can destroy all of the Y Legion’s giant robots.
Translated by ChatGPT 5
京公网安备 11011102002149号