結果
問題 | No.402 最も海から遠い場所 |
ユーザー | maspy |
提出日時 | 2020-03-12 21:37:53 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 593 bytes |
コンパイル時間 | 228 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 166,880 KB |
最終ジャッジ日時 | 2024-04-29 22:44:14 |
合計ジャッジ時間 | 17,064 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 446 ms
44,336 KB |
testcase_01 | AC | 447 ms
44,092 KB |
testcase_02 | AC | 466 ms
44,088 KB |
testcase_03 | AC | 443 ms
43,960 KB |
testcase_04 | AC | 445 ms
44,084 KB |
testcase_05 | AC | 449 ms
44,084 KB |
testcase_06 | AC | 451 ms
44,080 KB |
testcase_07 | RE | - |
testcase_08 | AC | 454 ms
44,336 KB |
testcase_09 | AC | 468 ms
44,336 KB |
testcase_10 | RE | - |
testcase_11 | AC | 452 ms
44,336 KB |
testcase_12 | WA | - |
testcase_13 | AC | 450 ms
44,336 KB |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | WA | - |
testcase_18 | AC | 1,427 ms
166,464 KB |
testcase_19 | AC | 1,414 ms
166,880 KB |
testcase_20 | AC | 1,434 ms
166,504 KB |
testcase_21 | AC | 1,431 ms
166,808 KB |
ソースコード
#!/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())