CF60B.Serial Time!
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Cereal Guy's friend Serial Guy likes to watch soap operas. An episode is about to start, and he hasn't washed his plate yet. But he decided to at least put in under the tap to be filled with water. The plate can be represented by a parallelepiped k × n × m, that is, it has k layers (the first layer is the upper one), each of which is a rectangle n × m with empty squares ('.') and obstacles ('#'). The water can only be present in the empty squares. The tap is positioned above the square (x, y) of the first layer, it is guaranteed that this square is empty. Every minute a cubical unit of water falls into the plate. Find out in how many minutes the Serial Guy should unglue himself from the soap opera and turn the water off for it not to overfill the plate. That is, you should find the moment of time when the plate is absolutely full and is going to be overfilled in the next moment.
Note: the water fills all the area within reach (see sample 4). Water flows in each of the 6 directions, through faces of 1 × 1 × 1 cubes.
肥皂剧迷 Serial Guy 喜欢看肥皂剧。一集即将开始,而他还没洗碗。但他决定至少先把碗放到水龙头下,让水将其注满。该碗可建模为一个 k×n×m 的平行六面体,即它共有 k 层(第 1 层为最上层),每层均为一个 n×m 的矩形,其中包含空格子(用 '.' 表示)和障碍物(用 '#' 表示)。水只能存在于空格子中。水龙头位于第 1 层的格子 (x,y) 正上方,且保证该格子为空。每分钟恰好有一单位体积(即一个 1×1×1 的立方体)的水落入碗中。请计算 Serial Guy 应在多少分钟后离开肥皂剧并关闭水龙头,以避免碗被注满溢出。换言之,你需要找出碗恰好被完全注满(下一分钟将开始溢出)的时刻。
注意:水会填满所有可达区域(参见样例 4)。水可在六个方向(上下前后左右)流动,流经 1×1×1 立方体的面。
输入格式
The first line contains three numbers k, n, m (1 ≤ k, n, m ≤ 10) which are the sizes of the plate. Then follow k rectangles consisting of n lines each containing m characters '.' or '#', which represents the "layers" of the plate in the order from the top to the bottom. The rectangles are separated by empty lines (see the samples). The last line contains x and y (1 ≤ x ≤ n, 1 ≤ y ≤ m) which are the tap's coordinates. x is the number of the line and y is the number of the column. Lines of each layer are numbered from left to right by the integers from 1 to n, columns of each layer are numbered from top to bottom by the integers from 1 to m.
第一行包含三个数字 k、n、m(1 ≤ k, n, m ≤ 10),表示平板的尺寸。随后是 k 个矩形,每个矩形由 n 行组成,每行包含 m 个字符 '.' 或 '#',这些矩形按从上到下的顺序表示平板的“层”。矩形之间以空行分隔(参见样例)。最后一行包含 x 和 y(1 ≤ x ≤ n,1 ≤ y ≤ m),表示水龙头的坐标;其中 x 是行号,y 是列号。每一层的行从左至右编号为 1 到 n,列从上至下编号为 1 到 m。
输出格式
The answer should contain a single number, showing in how many minutes the plate will be filled.
答案应为一个数字,表示盘子被填满所需的分钟数。
输入输出样例
输入#1
1 1 1 . 1 1
输出#1
1
输入#2
2 1 1 . # 1 1
输出#2
1
输入#3
2 2 2 .# ## .. .. 1 1
输出#3
5
输入#4
3 2 2 #. ## #. .# .. .. 1 2
输出#4
7
输入#5
3 3 3 .#. ### ##. .## ### ##. ... ... ... 1 1
输出#5
13
输入解题思路,AI测评打分。不知道怎么写?