#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 KK.

There are NN challenges in total, carried out in order. The ii-th challenge has an attribute aia_i:

  • If ai0a_i \geq 0, then after succeeding in this challenge, they can obtain an additional backpack with capacity aia_i.
  • If ai=1a_i = -1, then after succeeding in this challenge, they can obtain a map fragment of size 11.

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 NN 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 LL 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 ii-th challenge is pi%p_i\%. 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 N,L,KN, L, K.

The second line contains NN real numbers. The ii-th real number pip_i indicates the success percentage of the ii-th challenge.

The third line contains NN integers. The ii-th integer aia_i indicates the attribute value of the ii-th challenge.

Output Format

Output one number, representing the required probability, rounded to 66 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 100%100\% of the testdata, it is guaranteed that 0K20000 \leq K \leq 2000, 0N2000 \leq N \leq 200, 1ai1000-1 \leq a_i \leq 1000, 0LN0 \leq L \leq N, and 0pi1000 \leq p_i \leq 100.

Translated by ChatGPT 5