A1111 | [COCI-2007_2008-contest2]#5 PRVA
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Little Ivica solves crossword puzzles every day. In case you haven't seen one, a crossword puzzle starts on a grid of R×C squares, each of which is either empty or blocked. The player's task is to write words in consecutive empty squares vertically (top down) or horizontally (left to right).
Ivica's sister has a strange habit of looking at crosswords Ivica has finished solving, and finding the lexicographically smallest word in it. She only considers words at least 2 characters long.
Write a program that, given a crossword puzzle, finds that word.
Ivica's sister has a strange habit of looking at crosswords Ivica has finished solving, and finding the lexicographically smallest word in it. She only considers words at least 2 characters long.
Write a program that, given a crossword puzzle, finds that word.
输入格式
The first line contains two integers R and C (2 ≤ R, C ≤ 20), the number of rows and columns in the crossword.
Each of the following R lines contains a string of C characters. Each of those characters is either a lowercase letter of the English alphabet, or the character '#' representing a blocked square.
The input will be such that a solution will always exist.
Each of the following R lines contains a string of C characters. Each of those characters is either a lowercase letter of the English alphabet, or the character '#' representing a blocked square.
The input will be such that a solution will always exist.
输出格式
Output the lexicographically smallest word in the crossword.
输入输出样例
输入 #1
4 4 luka o#a# kula i#a#
输出 #1
kala
输入 #2
4 4 luka o#a# kula i#as
输出 #2
as
输入 #3
4 5 adaca da##b abb#b abbac
输出 #3
abb
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted