結果
| 問題 |
No.402 最も海から遠い場所
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-12 21:37:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 593 bytes |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 167,000 KB |
| 最終ジャッジ日時 | 2024-11-19 07:39:33 |
| 合計ジャッジ時間 | 19,464 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 2 RE * 5 |
ソースコード
#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
# %%
H, W = map(int, readline().split())
S = np.frombuffer(read(), 'S1').reshape(H, -1)[:, :W]
# %%
INF = 10 ** 8
dist = np.zeros((H + 2, W + 2), np.int32)
dist[1:-1, 1:-1] += INF * (S == b'#')
# %%
for _ in range(4):
dist = dist[::-1].T
for n in range(1, H + 2):
np.minimum(dist[n], dist[n - 1] + 1, out=dist[n])
np.minimum(dist[n, 1:], dist[n - 1, :-1] + 1, out=dist[n, 1:])
# %%
print(dist.max())
maspy