結果
問題 |
No.971 いたずらっ子
|
ユーザー |
![]() |
提出日時 | 2020-01-17 21:34:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 87,864 KB |
最終ジャッジ日時 | 2024-06-25 18:51:55 |
合計ジャッジ時間 | 7,346 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])