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

34418번 - Powering Teslopolis 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB17161694.118%

문제

The city of Teslopolis is an interesting city, to say the least. Due to its location at the peak of the Stormlight Mountains, the entire city is always encompassed by storms, and its residents have invented an ingenious method of harnessing the perpetual lightning to power the city: electrical resonant transformers (ERT's).

The ERT's are placed at strategic locations throughout Teslopolis and act as both lightning rods and electrical generators that attract, ground, and harness the lightning's energy. Each ERT is connected to and powers all adjacent buildings (including diagonally adjacent). However, the city currently has no method for rapidly determining if all buildings would be powered given the layout of a new subdivision. As an intern for the city's current administration, your boss has instructed you to write an algorithm that determines, given the layout of a planned subdivision, if all buildings are powered.

입력

The first line of input is the number of rows in the planned subdivision, 1ドル \leq N \leq 30,ドル followed by the number of columns in the planned subdivision, 1ドル \leq M \leq 30$. Following the first two lines are $N$ lines of exactly $M$ buildings (represented by a "b") or ERT's (represented by a "T").

출력

Output "True" if all buildings are powered. Output "False" if any building is not powered.

If not all buildings are powered, output in numerical order the row and column index location of each unpowered building. Numerical ordering means you should sort first by the $x$ values and then by the $y$ values. For example, if none of the locations are powered, you would print 0 0 followed by 0 1, 0 2, etc. until you reach the last row. Then, you would print 1 0, 1 1, etc. to repeat the pattern for all of the rows.

제한

예제 입력 1

3
3
bbb
bTb
bbb

예제 출력 1

True

예제 입력 2

4
3
bbT
Tbb
bbb
Tbb

예제 출력 2

False
2 2
3 2

노트

출처

School > CS@Mines > CS@Mines HSPC 2021 H번

  • 문제를 만든 사람: John Henke
(追記) (追記ここまで)

출처

대학교 대회

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

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