結果
| 問題 | No.3730 Jagged Minesweeper |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-09-03 04:39:58 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 935 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 53,888 KB |
| 最終ジャッジ日時 | 2026-09-19 13:01:46 |
| 合計ジャッジ時間 | 51,963 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 TLE * 9 -- * 23 |
ソースコード
import sys
from collections import deque
data = sys.stdin.buffer
n = int(data.readline())
target = [data.readline().strip() for _ in range(n)]
size = n * n
bomb, near, queued = bytearray(size), bytearray(size), bytearray(b"\1") * size
queue = deque(range(size))
directions = ((-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1))
while queue:
cell = queue.popleft()
queued[cell] = 0
r, c = divmod(cell, n)
wanted = near[cell] < target[r][c] - 48
if bomb[cell] == wanted:
continue
delta, bomb[cell] = (1 if wanted else -1), wanted
for dr, dc in directions:
nr, nc = r + dr, c + dc
if 0 <= nr < n and 0 <= nc < n:
nxt = nr * n + nc
near[nxt] += delta
if not queued[nxt]:
queued[nxt] = 1
queue.append(nxt)
print("\n".join("".join("o" if bomb[r * n + c] else "." for c in range(n)) for r in range(n)))