#K44052. Event Scheduling
Event Scheduling
Event Scheduling
You are given several test cases. In each test case, you have D available days and N events. Each event requires a specified number of consecutive days. Your task is to determine whether all events can be scheduled within the available days.
Mathematically, for each test case, let \(a_1, a_2, \dots, a_N\) be the required days for each event. The events can be scheduled if and only if
\[\sum_{i=1}^{N} a_i \le D\]
In such a case, output POSSIBLE
; otherwise, output IMPOSSIBLE
.
inputFormat
The first line contains an integer T, the number of test cases. For each test case, the input is given in three lines:
1. The first line contains a single integer D denoting the total available days.
2. The second line contains an integer N representing the number of events.
3. The third line contains N space-separated integers where each integer denotes the consecutive days required for an event.
Example:
2
10
3
2 3 4
5
3
2 2 2
outputFormat
For each test case, output a single line containing POSSIBLE
if all events can be scheduled within the available days, or IMPOSSIBLE
otherwise.
2
10
3
2 3 4
5
3
2 2 2
POSSIBLE
IMPOSSIBLE
</p>