题目名称 971. 填词游戏
输入输出 fillword.in/out
难度等级
时间限制 1000 ms (1 s)
内存限制 9 MiB
测试数据 10
题目来源 Gravatar王者自由 于2012-08-02加入
开放分组 全部用户
提交状态
分类标签
分享题解
通过:9, 提交:13, 通过率:69.23%
Gravatar赵寒烨 100 0.002 s 0.17 MiB Pascal
Gravatar王者自由 100 0.002 s 0.29 MiB C++
GravatarBokjan 100 0.002 s 0.29 MiB C++
Gravatar紫葉 100 0.002 s 0.29 MiB C
Gravatar江羽道 100 0.002 s 0.29 MiB C
Gravatar紫葉 100 0.002 s 0.29 MiB C
Gravatar紫葉 100 0.003 s 0.29 MiB C
Gravatar紫葉 100 0.003 s 0.29 MiB C++
Gravatar斗鹰 100 0.004 s 4.40 MiB C
Gravatar紫葉 20 0.002 s 0.29 MiB C
关于 填词游戏 的近10条评论(全部评论)
这题是什么意思?。。
GravatarGaoErFu
2015-11-15 10:49 1楼

971. 填词游戏

☆   输入文件:fillword.in   输出文件:fillword.out   简单对比
时间限制:1 s   内存限制:9 MiB

【题目描述】

Alex likes solving fillwords. Fillword is a word game with very simple rules. The author of the fillword takes rectangular grid (M cells width, N cells height) and P words. Then he writes letters in the cells of the grid (one letter in one cell) so that each word can be found on the grid and the following conditions are met:

no cell belongs to more than one word

no cell belongs to any word more than once

Some word W (let us consider its length being k) is found on the grid if you can find such sequence of cells (x1, y1), (x2, y2), ..., (xk, yk) that:

(xi, yi) and (xi+1, yi+1) are neighbors (|xi-xi+1| + |yi-yi+1| = 1) for each i = 1, 2, ..., k-1

W[i] is written in the cell with coordinates (xi, yi).

The task is to find all the words on the grid. After they are found, you see that the letters in some cells are not used (they do not belong to any found word). You make up a secret word using these letters and win a big prize.

To make things clear, let us consider the following example (the words are BEG and GEE):


Your task is to help Alex to solve fillwords. You should find out which letters will be left after he finds all the words on the grid. The most difficult task -- to make up a secret word out of them -- we still reserve to Alex.

【输入格式】

The first line of the input file contains three integer numbers -- N, M (2 <= M, N <= 10) and P (P <=100). Next N lines contain M characters each, and represent the grid. The following P lines contain words that are to be found on the fillword grid.

Fillword will always have at least one solution. All characters occurring in fillword will be capital English letters.

【输出格式】

Output letters from, which a secret word should be made up. Letters should be output in lexicographical order.

【样例输入】

3 3 2
EBG
GEE
EGE
BEG
GEE

【样例输出】

EEG

【来源】

Northeastern Europe 2001, Northern Subregion

POJ 1629