|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
You fell asleep at your desk (again!) and were awakened by the sound of the newly installed security-cam robots rolling out into the office corridors. You know you’ll be in big trouble if any of these robots manages to record your image. Luckily, you are able to quickly call up on your desktop computer the route each robot is programmed to follow. You need to plan your own movements to stay out of a direct line of sight of any of the robots.
The robots move in discrete steps of unit size, moving either to the north, east, west, or south. You may move, also in discrete steps of unit size, in one of these same directions (walls permit- ting), but you also have the option of remaining in place for a step. You and all robots move simultaneously.
Neither you nor the robots may move through walls, nor can either you or the robots move outside the building.
The robots take a photograph in each of the NSEW directions immediately after moving. To be captured in a photo, you would have to be directly along a NS or EW line from a robot with no walls between you. You are also considered to have been spotted if, at the end of any movement, you are directly on top of a robot.
Input consists of one or more mazes. Each maze begins with a line containing two integers, w and h, denoting the width (west-east) and the height (north-south) of the maze. Neither you nor the robots may leave this area. It is considered to be implicitly enclosed, but may contain other walls. End of input is indicated when either w or h is less than 3.
This is followed by h lines of input, each containing at least w characters. In each of these lines, only the first w characters are significant. Extra characters should be ignored.
The interpretation of the characters in these lines is as follows:
Each maze will be followed by N lines (where N is the total number of robots). Each line will contain from 0 to 80 characters. All N lines will contain the same number of characters. These characters will be chosen from among NSEW to denote North, South, East, and West, where ’North’ points towards the portion of the maze described by the first line of input and ’West’ points to the portion of the maze denoted by the first column of each line of the maze input. These characters describe the movement of the robots, one step in the maze at a time.
For each maze, you should print a single line of the form:
You can hide for M turns.
where M is the maximum number of steps the robots can take before you are seen. If you can avoid detection during the entire predicted movement of the robots, M will be the number of steps given for each robot in the text.
12 7 XXXXXXXXXXXX X 1 X X X X X X X X XXX X X 0 XXXYX XXXXXXXXXXXX NNEWSWWW EEEWWWWW 0 0
You can hide for 2 turns.