#K83782. Parking Bicycles in Racks
Parking Bicycles in Racks
Parking Bicycles in Racks
You are given multiple test cases. In each test case, you are provided with the number of racks R, the number of bicycles B that need to be parked, and a list of capacities for each rack. The task is to determine if it is possible to park all the bicycles without exceeding the capacities of the racks.
Mathematically, let the capacities be \(a_1, a_2, \dots, a_R\). You need to check if:
[ \sum_{i=1}^{R} a_i \ge B ]
If the total capacity is greater than or equal to \(B\), print YES
; otherwise, print NO
.
inputFormat
The input is given via stdin and contains multiple test cases.
- The first line contains an integer \(T\) representing the number of test cases.
- For each test case, there are two lines:
- The first line contains two integers \(R\) and \(B\), where \(R\) is the number of racks and \(B\) is the number of bicycles.
- The second line contains \(R\) integers, representing the maximum capacities of each rack.
outputFormat
For each test case, output a single line with YES
if all bicycles can be parked, or NO
otherwise. The output should be written to stdout.
2
3 8
3 3 3
2 5
2 2
YES
NO
</p>