SCPC11B - Alaska
The Alaska Highway runs 1422 miles from Dawson Creek, British Columbia to Delta Junction, Alaska.
Brenda would like to be the first person to drive her new electric car the length of the highway. Her car can travel up to 200 miles once charged at a special charging station. There is a charging station in Dawson Creek, where she begins her journey, and also several charging stations along the way. Can Brenda drive her car from Dawson City to Delta Junction and back?
Input
The input contains several scenario. Each scenario begins with a line containing n, a positive number indicating the number of charging stations. n lines follow, each giving the location of a filling station on the highway, including the one in Dawson City. The location is an integer between 0 and 1422, inclusive, indicating the distance in miles from Dawson Creek. No two filling stations are at the same location. A line containing 0 follows the last scenario.
Output
For each scenario, output a line containing POSSIBLE if Brenda can make the trip.
Otherwise, output a line containing the word IMPOSSIBLE.
Example
Input: 2 0 900 8 1400 1200 1000 800 600 400 200 0 0 Output: IMPOSSIBLE POSSIBLE
hide comments
Dushyant Singh:
2015-06-05 16:56:32
@ Bhuvnesh Jain: 0 represents the distance of first charging station and it will always be zero. Last edit: 2015-06-05 16:57:12 |
|
Bhuvnesh Jain:
2015-06-04 22:04:56
is the sample input given right...
|
|
swordfish12:
2015-03-01 08:19:11
simple ---
|
|
Karan Desai:
2015-01-26 07:38:17
AC in one go! ^_^ |
|
cegprakash:
2011-10-23 08:45:31
"and back" |
|
[Rampage] Blue.Mary:
2011-10-19 06:27:08
and back. |
Added by: | Ali Arous |
Date: | 2011-10-19 |
Time limit: | 4.849s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Syrian Collegiate Programming Contest 2011 |