CF60B.Serial Time!

普及/提高-

通过率:0%

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×mk×n×m , that is, it has kk layers (the first layer is the upper one), each of which is a rectangle n×mn×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)(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×11×1×1 cubes.

输入格式

The first line contains three numbers kk , nn , mm ( 1<=k,n,m<=101<=k,n,m<=10 ) which are the sizes of the plate. Then follow kk rectangles consisting of nn lines each containing mm 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 xx and yy ( 1<=x<=n,1<=y<=m1<=x<=n,1<=y<=m ) which are the tap's coordinates. xx is the number of the line and yy is the number of the column. Lines of each layer are numbered from left to right by the integers from 11 to nn , columns of each layer are numbered from top to bottom by the integers from 11 to mm .

输出格式

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
    
首页