#C10126. Storage Capacity Check

    ID: 39297 Type: Default 1000ms 256MiB

Storage Capacity Check

Storage Capacity Check

You are given a number of test cases. Each test case describes a set of shelves with items and a limit that a worker can handle. For each test case, compute the total number of items on the shelves. If the total does not exceed the limit, print Possible; otherwise, print Impossible.

Formally, for each test case, you are given an integer \(N\) representing the number of shelves, an array \(a = [a_1, a_2, \dots, a_N]\) where each \(a_i\) is the number of items on the \(i\)-th shelf, and an integer \(L\) representing the storage limit. The task is to determine whether

[ \sum_{i=1}^{N} a_i \le L ]

If this inequality holds, output Possible; otherwise, output Impossible.

inputFormat

The first line of input contains an integer \(T\) (\(1 \le T \le 100\)) representing the number of test cases. For each test case:

  • The first line contains an integer \(N\) (\(1 \le N \le 100\)), the number of shelves.
  • The second line contains \(N\) space-separated integers, where the \(i\)-th integer \(a_i\) (\(0 \le a_i \le 10^9\)) represents the number of items on the \(i\)-th shelf.
  • The third line contains an integer \(L\) (\(0 \le L \le 10^9\)), the storage limit.

outputFormat

For each test case, output a single line containing the answer: Possible if the total number of items is less than or equal to \(L\), and Impossible otherwise.

## sample
3
2
5 10
20
3
4 7 9
19
1
1000
999
Possible

Impossible Impossible

</p>