시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
6 초 (추가 시간 없음) | 512 MB | 65 | 3 | 2 | 4.545% |
Since you had extra money, you decided to go to the local orphanage to donate some toys. After a few minutes of research, you discover that the children there like a new inexpensive kind of toy called AdoraBalls. These balls come in four different colors – azure, blue, cyan, and denim. One can obtain these adorable AdoraBalls by purchasing any of the following AdoraBall bundles:
With this info, you decided to go to the local orphanage to donate AdoraBalls for them to play with. Each child in the orphanage has exactly one favorite color among the four. For example, some of the younger ones like to have cyan balls because of their brightness. Most of the mature ones prefer to have blue balls. As you are a thoughful donor, you want to make sure that each child only receives AdoraBalls which are of their favorite color. Moreover, to prevent jealousy within themselves, you decide that you must give each child exactly the same number of AdoraBalls. Furthermore, since you are not cruel, you decide that each child should receive at least one AdoraBall.
Your plan is then to buy a combination of these bundles, unpack them and give the same number of AdoraBalls to each child. Now, you decide on buying E Bundles of Enjoyment, F Bundles of Festivity, G Bundles of Glee and H Bundles of Happiness. You want to determine if there exist E,F,G,H such that each child receives AdoraBalls which are exclusively their favorite color and each receives the same non-zero amount of AdoraBalls. Moreover, you require that none of them gets left over because you don’t particularly find these AdoraBalls adorable.
If there are exactly a0 children whose favorite color is azure, b0 children whose favorite color is blue, c0 children whose favorite color is cyan, and d0 children whose favorite color is denim, is it possible to find non-negative integers E,F,G,H satisfying your constraints?
The first line of input contains a single integer T, the number of test cases.
Each test case is described using five lines.
Constraints
For each test case, output a line containing a single string S, where S = POSSIBALL
if it is possible to find E,F,G,H satisfying the constraints described in the problem statement and S = IMPOSSIBALL
otherwise.
3 3 3 4 4 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 3 3 4 4 1 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 3 3 4 4 1 2 4 3 2 1 1 4 2 4 3 1 2 1 4 1
POSSIBALL IMPOSSIBALL POSSIBALL