0 人解决,3 人已尝试。
0 份提交通过,共有 4 份提交。
9.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
They look like a random collection of characters, but if you look closer you can find interesting words in them. Often it is hard to find all words. In this case it is even harder, because you are to find all occurences of words which are contained several times.
You are given a rectangle consisting of lowercase characters and a list of words also in lowercase. For each given word you are to print all occurences of the word in the rectangle by giving the coordinates and the direction how to read the word.
The input consists of multiple runs.
The first line of each run contains two integers defining the width and height of the rectangle (1 <= w,h <= 1000). The next h lines consist of w lowercase characters terminated by a newline.
Subsequently a line consisting of a single integer (0<= n <= 1000) is given that indicates the number of words following. The next n words are separated by spaces or newlines and contain at least 2 and up to 1000 lowercase characters.
Input is terminated by a run with both width and height 0.
For each run you are to print an opening header like Run N:, where N is the number of the run starting with 1 for the first run and incremented by 1 for successive runs.
For each word found you should print lines like W @ X Y D, where W is the word which was found X is the column starting with 1 for the leftmost column Y is the line starting with 1 for the uppermost line D is one of N, NE, E, SE, S, SW, W, NW describing the direction to read the word with N for north meaning the word is a single column and is read from bottom to top.
If more than one match is found you should order your output first by the row number, then by the column number and finally by the direction using the order given above.
Each run is terminated by a blank line with exactly one newline.
4 3 gacm tbib nurb 4 acm bib winner rbg 0 0
Run 1: acm @ 2 1 E bib @ 2 2 E bib @ 4 2 W rbg @ 3 3 NW
0 人解决,3 人已尝试。
0 份提交通过,共有 4 份提交。
9.9 EMB 奖励。