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

30132번 - Minesweeper 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB154444232.558%

문제

Minesweeper is a single-player computer game. The objective of the game is to clear an abstract minefield without detonating a mine. When the game is started, the player is presented with a grid of n x m blank squares. If the player clicks on a square without a mine, a digit is revealed in that square, the digit indicating the number of adjacent squares that contains mines. Two squares are adjacent if they share an edge or a corner, i. e. a square can have at most 8 adjacent squares. By using logic, players can in many instances use this information to deduce that certain other squares are mine-free (or mine-filled), and proceed to click on additional squares to clear them or mark them with flag graphics to indicate the presence of a mine.

Clark Kent is a Minesweeper addict. And with help from his Kryptonian (a planet far far away from earth) powers he solves them at lightning speed and gives them to you. Your job is to tell him whether the solved version is correct or not. A board is correctly solved iff all flagged squares should contain a mine and every square containing a number X has exactly X adjacent squares flagged.

입력

The first line of input will contain an integer T ≤ 20 denoting the number of test cases.

Each test case will be formatted as follows:-

  • The first line will contain two integers separated by a single space denoting 1≤n≤20 and 1 ≤ m≤20 respectively.
  • The next n lines will contain m characters each. Each character will either be a digit (0 to 8 inclusive) or 'F'. The presence of 'F' indicates that Clark has flagged the square. The digits indicate the number of mines in the adjacent squares.

출력

Output one line per case:-

  • 'Well done Clark!' if the board was solved successfully.
  • 'Please sweep the mine again!' otherwise.

Note that quotes are for clarity only.

제한

예제 입력 1

2
8 8
F1012210
1101FF21
121234F1
F2F11F21
12111121
1100012F
F21101F2
12F10111
8 8
F1012210
1101FF21
121234F1
F2FF1F21
12111121
1100012F
F21101F2
12F10111

예제 출력 1

Well done Clark!
Please sweep the mine again!

힌트

출처

ICPC > Regionals > Asia West Continent > India > The 2008 Asia Amritapuri Contest D번

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

출처

대학교 대회

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

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