#K44682. Beam Cutting Problem

    ID: 27586 Type: Default 1000ms 256MiB

Beam Cutting Problem

Beam Cutting Problem

You are given two lists of integers: one representing the required heights and another representing the available beam lengths. Your task is to determine if each required height can be achieved by cutting one of the available beams. A beam of length \(b\) can be cut down to any size less than or equal to \(b\).

Formally, for each required height \(h\), if there exists a beam with length \(b\) such that \(b \geq h\), then the answer is YES; otherwise, the answer is NO.

Note: The same beam can be used to fulfill multiple required heights.

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. The first line contains two space-separated integers \(n\) and \(m\) where \(n\) is the number of required heights and \(m\) is the number of available beams.
  2. The second line contains \(n\) space-separated integers representing the required heights.
  3. The third line contains \(m\) space-separated integers representing the available beam lengths.

outputFormat

Output \(n\) lines to standard output (stdout). For each required height, output YES if there exists an available beam with a length greater than or equal to that height, or NO otherwise.

## sample
3 3
5 10 15
10 5 20
YES

YES YES

</p>