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

11251번 - Romance of The Three Kingdom 다국어

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

문제

In Han dynasty, Chinese is divided to three kingdom: Cao Wei (by Cao Cao), Shu Han (by Liu Bei) and Dong Wu (by Sun Quan). After that, Chinese is merged in one kingdom. In this task, same kingdom is connected in 4 directions: up, down, left and right.

Chinese has R row C column which '.' is sea, 'X' (Greater X) is land. e.g. R=6, C=14 shown

XXX........... 111........... 111...........
X.X.XXXX...... 1.1.2222...... 1.1.2222......
XXX.X....XXXXX 111.2....33333 111.2....33333
X.X.X....X.X.X 1.1.2....3.3.3 1.1x2....3.3.3
....XXXX.X.X.X ....2222年3月3日.3 ....2222x3.3.3
.........X.X.X .........3.3.3 .........3.3.3

Left image is Chinese land initiation

Middle image describes name of each kingdom

Right image is new Chinese kingdom that cover 2 sea blocks to connect three kingdom.

Write program to find minimum sea block to cover for connect three kingdom.

입력

First line integer Q (Q <= 15), number of question

Each question

First line integer R C separated with blank space (1 <= R, C <= 50)

Next R line input Chinese map which '.' is sea, 'X' (Greater X) is land.

Guarantee input map has exactly three kingdom.

출력

Q line each line show minimum sea block to cover for connect three kingdom.

제한

예제 입력 1

2
6 14
XXX...........
X.X.XXXX......
XXX.X....XXXXX
X.X.X....X.X.X
....XXXX.X.X.X
.........X.X.X
5 13
..XXX.....XX.
.XXXXX.......
.XXX....XXXXX
.XXX....XXXXX
.XXX....XXXXX

예제 출력 1

2
4

힌트

There are 2 question:

First question describes in task above

Second question Chinese connect with 4 blocks shown

..111.....22.
.11111xxx..x.
.111....33333
.111....33333
.111....33333

출처

ICPC > Regionals > Asia Pacific > Thailand > Thailand Central Group-B Programming Contest > Thailand Central Group-B Programming Contest 2015 E번

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

출처

대학교 대회

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

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