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

7624번 - Minesweeper 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB125266.667%

문제

In the game of minesweeper, you are shown a grid. Some cells in the grid contain mines. If you think that a cell does not contain a mine, you can reveal that cell. If the cell contained a mine, you lose, but if not, then you learn how many neighboring cells, including diagonals, also contain mines.

Given a minesweeper grid, determine which cells must contain mines and which cells cannot contain mines.

입력

The first line of input is two integers, the width and height of the grid. The remainder of the input is an image of the grid. A cell containing a digit is revealed, which means that it contains no mine and that the number of adjacent mines (including diagonals) is that digit. A cell containing a period is not revealed.

The grid is at most 30 columns by 16 rows. This problem is, in general, hard, so we will not give input in which the number of possible arrangements of mines adjacent to revealed cells is more than a few tens of thousands. We also guarantee that there is at least one valid arrangement of mines.

출력

Output an image of the grid. Each revealed cell should have its digit printed, cells that must contain mines are marked by “*,” and cells that cannot contain mines but are not revealed are marked by a space.

제한

예제 입력 1

16 11
000000000002....
000000000002....
0000000000012...
00000000000012..
0000000000000122
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000

예제 출력 1

000000000002*...
000000000002* ..
0000000000012* .
00000000000012**
0000000000000122
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000

힌트

출처

University > MIT > The MIT Programming Contest > 2008-09 > MIT Programming Contest Team Contest 1 2008 5번

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

출처

대학교 대회

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

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