No.1043 Series University
Problem Statement
Takahashi is a student at Series University (abbreviated as Chokudai).
Today's experiment at Series University uses dry cell batteries and miniature light bulbs. In this experiment, $N$ batteries and $M$ light bulbs are provided; the voltage of the $i$-th battery is $V_i$, and the resistance of the $j$-th light bulb is $R_j$. What Takahashi has to do today is to choose any number of batteries and any number of light bulbs from those provided, connect them in series, and make the light bulbs glow.
The light bulbs do not glow unless a current of at least $A$ flows through them. On the other hand, a current greater than $B$ is dangerous, so the current must be at most $B$. Here, the value of the current flowing through the light bulbs is given by (the sum of the voltages of the connected batteries) $/$ (the sum of the resistances of the connected light bulbs).
Takahashi no longer knows how he should choose the batteries and light bulbs, so find the number of combinations of batteries and light bulbs he should choose, modulo $1000000007$. Note that $2$ combinations are considered different if there is a battery or light bulb used in only one of them; the order in which batteries and light bulbs are connected does not matter.
(Note) The time limit is strict for Python, and the writer/tester could not get AC with it. It has been confirmed that AC is possible with PyPy, so we recommend selecting PyPy when submitting in Python.
Input
$N\ M$ $V_1\ V_2\ \dots\ V_N$ $R_1\ R_2\ \dots\ R_M$ $A\ B$
$1 \le N,M \le 100$
$1 \le V_i,R_j \le 1000$
$1 \le A\le B \le 10^5$
All inputs are integers.
Output
Output the number of combinations of batteries and light bulbs with which Takahashi can safely make the light bulbs glow, modulo $1000000007$.
Sample
Sample 1
Input
2 2 5 10 1 1 3 100
Output
8
Among the ways to choose at least one battery and at least one light bulb, only the choice $(V_1,R_1,R_2)$ fails to satisfy the conditions.
Sample 2
Input
1 1 100 1 1 1
Output
0
There may be no combination that satisfies the conditions.
Sample 3
Input
5 5 1 2 3 4 5 1 2 3 4 5 1 5
Output
489
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Suunn
Ricky_pon