All submissions for this problem are available.
A mall has N chocolate multiplier machine numbered as 1, 2, 3, . . . N . Each machine has a multiplier number associated with it. Ai is the multiplier for the ith machine. If one chocolate is put into machine i, then it produces Ai chocolates. Now, Rob has X chocolates but his friend wants exactly Y chocolates on his birthday. Help Rob to guess if he can obtain exactly Y chocolates from X chocolates using the multiplier machines.
First line contains a single integer N, the number of multiplier machines.
Next line contains two space separated integers X and Y.
Next line contains N spaced integers, A1A2 . . AN
Print "POSSIBLE" if Rob can obtain exactly Y chocolates from X chocolates using the multiplier machines.
Otherwise print "IMPOSSIBLE"
1 ≤ N ≤ 10^5
1 ≤ Ai ≤ 10^9
0 < X < Y ≤ 10^9
1 ≤ Y - X ≤ 10^4
Input: 4 3 6 5 6 7 8 Output: IMPOSSIBLE
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
Fetching successful submissions