結果
問題 |
No.971 いたずらっ子
|
ユーザー |
![]() |
提出日時 | 2020-01-17 21:34:54 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 426 ms |
コンパイル使用メモリ | 82,796 KB |
実行使用メモリ | 280,276 KB |
最終ジャッジ日時 | 2024-06-25 18:54:10 |
合計ジャッジ時間 | 6,773 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | TLE * 1 -- * 20 |
ソースコード
H,W=map(int,input().split()) MAP=[list(input()) for i in range(H)] from collections import deque Q=deque() Q.append([0,0]) R=[[1<<30]*W for i in range(H)] R[0][0]=0 while Q: x,y=Q.pop() for z,w in [[x+1,y],[x,y+1]]: if 0<=z<H and 0<=w<W: if MAP[z][w]==".": R[z][w]=min(R[z][w],R[x][y]) else: R[z][w]=min(R[z][w],R[x][y]+z+w) Q.append((z,w)) print(H+W-2+R[-1][-1])