luogu#P1926. 小书童——刷题大军

小书童——刷题大军

Background

Math is fire, lighting the lamp of physics; physics is a lamp, illuminating the road of chemistry; chemistry is a road, leading to the pit of biology; biology is a pit, burying those who study science. Classical Chinese is fire, lighting the palace lamps of history; history is a lamp, illuminating the road of society; society is a road, leading to the big pit of philosophy; philosophy is a pit, burying liberal arts students. — Xiao A.

Problem Description

Xiao A is wildly “grinding problems”, blatantly “grinding problems”. He has found nn kinds of “problems” he likes in Xiao Shutong, and each “problem” has a required time. The teacher has assigned mm homework tasks, each with its required time and score, and the teacher stipulates that kk points or more is passing. Xiao A has only rr units of time left, and he wants to “grind” as many “problems” as possible on the basis of passing.

Input Format

The first line contains four integers n,m,k,rn,m,k,r.

The second line has nn numbers, representing the required time for each “problem”.

The third line has mm numbers, representing the required time for each homework task.

The fourth line has mm numbers, representing the score of each homework task.

Output Format

A single number, representing how many “problems” Xiao A can grind.

3 4 20 100
15 20 50
10 15 40 40
5 5 10 15
2

Hint

Constraints and Agreements

For 100%100\% of the testdata, n10n\le 10, m10m\le 10, k50k\le 50, r150r\le 150. It is guaranteed that passing is always possible.

Translated by ChatGPT 5