結果
問題 |
No.2695 Warp Zone
|
ユーザー |
|
提出日時 | 2024-03-23 12:01:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
MLE
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 516,264 KB |
最終ジャッジ日時 | 2024-09-30 13:10:56 |
合計ジャッジ時間 | 3,632 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 1 MLE * 1 -- * 22 |
ソースコード
from collections import deque H,W,N=map(int,input().split()) WARP={} for _ in range(N): a,b,c,d=map(int,input().split()) a-=1;b-=1;c-=1;d-=1 WARP[(a,b)]=(c,d) G=[[10**10 for _ in range(W)] for _ in range(H)] Q=deque([]) Q.append(((0,0),0)) while Q: (h,w),c=Q.popleft() c=min(c,G[h][w]) G[h][w]=c if h+1<H and c+1<G[h+1][w]:Q.append(((h+1,w),c+1)) if w+1<W and c+1<G[h][w+1]:Q.append(((h,w+1),c+1)) if (h,w) in WARP.keys(): nh,nw=WARP[(h,w)] if c+1<G[nh][nw]:Q.append((WARP[(h,w)],c+1)) print(G[H-1][W-1])