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

26579번 - Bomb 다국어

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

문제

Bomberman is having some trouble defeating his enemies, and he has asked you to help him figure out where to place his bomb in order to defeat the most enemies. In this scenario, bomberman's bombs destroy everything in the four cardinal directions to the edge of the map, except for stopping at walls that cannot be broken. Write a program that finds the best spot to place a bomb to destroy the most enemies.

입력

The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will start with two integers, r c representing the number of rows and columns in each map, respectively. The next r lines will consist of c characters, representing the map. # denotes a wall, . is a blank space, and @ is an enemy. The bomb can only be placed in a blank space. Rows are numbered 0 to r-1 and columns are numbered 0 to c-1.

출력

Output the coordinate for the bomb, in the format r, c, where r is the row number and c is the column number. The bomb will explode outward in the four cardinal directions, destroying any enemy in its path. The explosion only stops in one direction when it reaches the end of the map or when it hits a wall, in which case any enemy past that wall is safe. Assume that there will always be at least one enemy that a bomb can hit, and there will never be more than one best placement.

제한

예제 입력 1

2
9 17
#.#.#.#.#@#.#.#.#
..@..............
#.#.#.#.#.#.#.#.#
.........@.......
#.#.#.#.#.#.#.#.#
.....@........@..
#.#.#.#.#.#.#.#.#
...........@.....
#.#.#.#.#.#.#.#.#
5 5
#####
#...#
#.#@#
#.@.#
#####

예제 출력 1

5, 9
3, 3

힌트

출처

School > PLU High School Programming Contest > PLU 2020 > Novice 7번

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

출처

대학교 대회

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

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