The BattleProblem code: A004 |
All submissions for this problem are available.
Now that the location of the Frigates and the Mother-ship has been determined , it is time to take back the Empire . In the final battle against the invaders , the Empire has the option of using the BIOTELEPORT weapon .
It is prototype and is not perfect .
What the weapon does is , it teleports a given number of targets ( let us say T1 ) to a given location , but since the weapon is not perfect , if MORE SUCH TARGETS ARE PRESENT , it TELEPORTS BACK a certain number of targets (say C1 ) that it had teleported previously , to their original location .
The weapon has two configurations :
First configuration teleports T1 targets and teleports back C1 targets ( T1 > C1 ) .
Second configuration teleports T2 targets and teleports back C2 targets (T2 > C2 ) .
The configurations can be interchanged when ever required .
The weapon also has certain limitations .
It can be used only when a minimum number of targets T1 or T2 , as the case may be , are present .
It needs to be decided whether it is possible to eliminate the enemies completely using the weapon in these two configuration from the galaxy .
Input
n N1 T1 C1 T2 C2 N1 T1 C1 T2 C2 .......... .......... .......... n timesWhere :
n : Number of test cases
N : Total number of targets .
T1: Teleportation capability of the first configuration of the weapon .
C1: Back Teleportation of the first weapon .
T2 : Teleporttion capability of the second configuration of the weapon .
C2 : Back Teleportation of the second weapon .
All values being integers in between 0 and 1000 .
Output
POSSIBLE or IMPOSSIBLE for each test case on a single line .
Example
Input: 2 25 1 0 17 3 213 99 6 74 22 Output: POSSIBLE IMPOSSIBLE
| Author: | roy |
| Date Added: | 23-02-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C, C99 strict, CPP 4.0.0-8, CPP 4.3.2, CS2, JAVA |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions
