Logo
(追記) (追記ここまで)

26557번 - Bomb 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB42413797.368%

문제

You decide to create a game involving a 3D maze with destructible walls, where all the character has to work with is bombs. In order to determine the number of bombs to provide for each level, you need to know the minimum amount necessary to reach the exit and base it off of that. Your task is to write a program that will find the smallest number of bombs necessary to reach the exit. Each bomb can destroy one wall, leaving a blank space in its place.

입력

The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will start with three integers f, r, and c, representing the number of layers, rows, and columns, respectively. The next f sets of r lines will be the maze, with every set of r lines being one layer of the maze.

The # represents a destructible wall, . represents an open space, S is the start location, and E is the exit location. You can only move up, down, left, and right (i.e., you cannot move diagonally). You can move freely between layers, but a move between layers stays in the same relative grid location.

출력

Output the smallest number of bombs necessary to escape the maze. There will be no trailing white space.

제한

예제 입력 1

2
2 3 3
S##
##E
###
#.#
#..
###
1 2 10
S#.####.#E
..##..###.

예제 출력 1

1
5

힌트

출처

School > PLU High School Programming Contest > PLU 2018 > Advanced 11번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /