#C11656. Park Cleanup Challenge

    ID: 40996 Type: Default 1000ms 256MiB

Park Cleanup Challenge

Park Cleanup Challenge

In this problem, you are given schedules for cleaning multiple parks. Each park is maintained by a team consisting of several crew members. For each park, you are provided with two values: the number of crew members (C) and a deadline in days (D). Following this, there are (C) integers representing the number of days each crew member requires to clean the park. A park can be cleaned on time if at least one crew member can finish cleaning within (D) days, i.e. if there exists a crew member with a cleaning time (t) such that (t \le D). Your task is to determine for each park whether it can be cleaned on time. Output "YES" if at least one crew member meets the deadline, or "NO" otherwise.

The input begins with an integer (T) representing the number of test cases. Each test case starts with an integer (P) denoting the number of parks. For each park, the first line contains two integers (C) and (D) separated by a space, followed by a line with (C) integers representing the cleaning days for each crew member. The output for each test case should consist of (P) lines, each containing either "YES" or "NO".

inputFormat

The first line contains an integer (T), the number of test cases. For each test case:

  • The first line contains an integer (P), the number of parks. For each of the next (P) parks:
    • The first line contains two integers (C) and (D) separated by a space, where (C) is the number of crew members and (D) is the deadline in days.
    • The following line contains (C) space-separated integers representing the number of days each crew member requires to clean the park.

All input is given via standard input (stdin).

outputFormat

For each park in every test case, output a single line containing "YES" if the park can be cleaned on time (i.e., there exists at least one crew member with a cleaning time (\le D)), or "NO" otherwise. Output is printed to standard output (stdout).## sample

4
3
5 3
1 2 3 4 5
4 2
2 2 2 2
3 4
4 4 4
1
1 1
1
1
3 2
3 4 5
2
2 3
3 3
50 5
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
YES

YES YES YES NO YES YES NO

</p>