## Mock CCC '20 Contest 2 S5 - Sticks

View as PDF

Points: 20 (partial)
Time limit: 0.5s
Memory limit: 128M

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

You have sticks each of length metres and sticks each of length metres which you are trying to place into one of tubes. Tube has a length of metres. Each tube can fit some number of sticks such that sum of the length of the sticks do not exceed . Each stick can also only go in at most one tube. What is the maximum number of sticks that can be put into the tubes?

#### Input Specification

The first line will contain two integers, .
The second line will contain two integers, .
We will guarantee and .

The third line will contain the integer .
The fourth line will contain integers, .

#### Output Specification

Output the maximum number of sticks that can be put into the tubes.

For 2/15 of the points,

For an additional 7/15 of the points,

#### Sample Input

3 2
4 2
2
6 5

#### Sample Output

3