#K69157. Roller Coaster Ride Eligibility

    ID: 33024 Type: Default 1000ms 256MiB

Roller Coaster Ride Eligibility

Roller Coaster Ride Eligibility

You are given a group of people who want to ride a roller coaster. Each person in the group has a height. The roller coaster has a minimum and a maximum height requirement and a limited seating capacity defined by the number of rows and columns. The group can ride the coaster only if:

  • The number of people is less than or equal to the total number of seats (i.e. \( rows \times columns \)).
  • Each person's height is between the minimum and maximum height inclusive (i.e. \( minHeight \leq height \leq maxHeight \)).

Determine whether the entire group can ride the roller coaster.

inputFormat

The input is read from standard input (stdin) and has three lines:

  1. An integer \( n \) representing the number of people.
  2. \( n \) space-separated integers representing the heights of the group.
  3. Four space-separated integers: \( minHeight \), \( maxHeight \), \( rows \), and \( columns \).

outputFormat

Output a single line to standard output (stdout):

  • Print True if the group can all ride the roller coaster; otherwise, print False.
## sample
4
120 130 140 150
110 160 2 2
True

</p>