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

11370번 - Spawn of Ungoliant 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB34325121676.596%

문제

The spider children of Ungoliant are spreading through Mirkwood. Each of the giant spiders cannot move from the tree which it inhabits; however, each can lay eggs in the trees adjacent to it. Each egg will rapidly hatch and grow into another spider, who will then lay their own eggs.

Given a map of Mirkwood, indicating where spider-filled and spider-free trees are, determine how far the spider infestation will spread.

For this problem, adjacency is one of the four cardinal directions (north, south, east, and west); two trees connected via a diagonal are not considered adjacent.

입력

The first line of an input case is of the form W H, where W is the width of the map and H is the height. The next H lines contain strings of length W specifying the layout of Mirkwood. An S character represents a spider-infested tree, and an T character represents a spider-free tree. A . (period) signifies open space on the forest floor, where there is no tree.

The end of input is signified by two zero’s, which is a case that should not be processed.

출력

For each test case, print out the map of Mirkwood once the spiders have spread as far as possible. There should be no blank lines between maps.

제한

예제 입력 1

3 4
T..
TST
..T
TTT
5 5
T.T.T
.T.T.
..S..
.T.T.
T.T.T
0 0

예제 출력 1

S..
SSS
..S
SSS
T.T.T
.T.T.
..S..
.T.T.
T.T.T

힌트

출처

School > University of Virginia High School Programming Contest > UVa HSPC 2014 F번

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

출처

대학교 대회

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

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