#P10504. 守卫者的挑战
守卫者的挑战
Problem Description
After opening the gate of the dark mage Vani, the team wandered through a maze-like path, searching aimlessly for the prison where applepi was held. Suddenly, a flash of light appeared before them.
“I, Nizem, am the guardian of the Dark Magic Temple. If you can pass my challenge, you may take the map of the Dark Magic Temple...”
In an instant, the team was teleported onto an arena. At the beginning, they had a backpack with capacity .
There are challenges in total, carried out in order. The -th challenge has an attribute :
- If , then after succeeding in this challenge, they can obtain an additional backpack with capacity .
- If , then after succeeding in this challenge, they can obtain a map fragment of size .
All map fragments must be stored in backpacks to be taken out of the arena. The backpacks do not have to be completely filled, but the team must take away all map fragments they have obtained (fragments not obtained do not matter; it is only required that after completing all challenges, the total backpack capacity is enough to hold the map fragments). Only then can they assemble the complete map. Also, they must succeed in at least challenges to leave the arena.
When the team was at a loss, the kind guardian Nizem estimated the success probability of each challenge. The success probability of the -th challenge is . Now, please help predict the probability that the team can leave the arena with the map fragments they obtained.
Input Format
The first line contains three integers .
The second line contains real numbers. The -th real number indicates the success percentage of the -th challenge.
The third line contains integers. The -th integer indicates the attribute value of the -th challenge.
Output Format
Output one number, representing the required probability, rounded to decimal places.
3 1 0
10 20 30
-1 -1 2
0.300000
5 1 2
36 44 13 83 63
-1 2 -1 2 1
0.980387
Hint
In the first sample, if the third challenge succeeds, then as long as one of the first two challenges is won, the team will have enough space to store the obtained map fragment. If the third challenge fails, then they did not obtain any map fragment at all, so there is no need to consider whether it can be stored. If the third challenge fails and one of the first two challenges is won, there will be no backpack to store the map fragment; if the first two challenges both fail, the requirement of succeeding at least once is not met. Therefore, the required probability is the probability that the third challenge is won.
For of the testdata, it is guaranteed that , , , , and .
Translated by ChatGPT 5