AMR11G - Here Be Dragons
The Triwizard Tournament's third task is to negotiate a corridor of many segments, and reach the other end. The corridor is N segments long. The ith segment is either empty or has a dragon. Harry cannot pass the dragon and will have no option but to retreat if he encounters one. Is it possible for him to reach the exit starting from the entrance?
The Triwizard Tournament's third task is to negotiate a corridor of many segments, and reach the other end. The corridor is N segments long. The ith segment is either empty or has a dragon. Harry cannot pass the dragon and will have no option but to retreat if he encounters one. Is it possible for him to reach the exit starting from the entrance?
Input (STDIN):
The first line contains the number of test cases T.
Each of the next T lines contains a string describing the corridor. The ith character is either a '.' if the segment is empty, or a 'D' if the segment contains a dragon.
Output (STDOUT):
Output T lines, each containing either the string "Possible" if you can reach the exit, and "You shall not pass!" if it is not possible to reach the exit.
Constraints:
1 <= T <= 50
1 <= N <= 50
Sample Input:
3
..
..D.
D..D
Sample Output:
Possible
You shall not pass!
You shall not pass!
hide comments
Aradhya:
2011-12-27 11:23:24
what is the q plzz sme xplain 2 me!!!! |
|
Aradhya:
2011-12-27 11:21:46
just cant understand..why my cde is not being accepted!!!!! |
|
PubLic_AvenGeR:
2011-12-26 06:59:55
one f d easiest.... |
|
Vivek Vardhan:
2011-12-24 13:30:15
tutorial problem |
|
~neo~:
2012-01-26 23:54:46
tutorial. |
|
blashyrkh:
2011-12-19 12:14:49
Move to tutorial or allow only Brainf**k. |
|
Devil D:
2011-12-19 08:43:00
tutorial problem |
Added by: | Varun Jalan |
Date: | 2011-12-15 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Varun Jalan - ICPC Asia regionals, Amritapuri 2011 |