結果
問題 |
No.2354 Poor Sight in Winter
|
ユーザー |
![]() |
提出日時 | 2023-06-17 01:32:43 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 728 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 79,944 KB |
最終ジャッジ日時 | 2024-06-24 18:44:00 |
合計ジャッジ時間 | 16,335 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 RE * 8 TLE * 2 |
ソースコード
import sys input = sys.stdin.readline from heapq import heappop,heappush N,K=map(int,input().split()) sx,sy,gx,gy=map(int,input().split()) P=[list(map(int,input().split())) for i in range(N)] P.append([sx,sy]) P.append([gx,gy]) OK=2*10**5 NG=-1 while OK>NG+1: mid=(OK+NG)//2 DP=[1<<30]*(N+2) DP[N]=0 Q=[(0,N)] while Q: dis,ind=heappop(Q) x,y=P[ind] for i in range(N+2): z,w=P[i] dis=abs(x-z)+abs(y-w) dis-=mid k=max(0,(dis+mid-1)//mid) if DP[i]>DP[ind]+k: DP[i]=DP[ind]+k heappush(Q,(DP[i],i)) if DP[N+1]<=K: OK=mid else: NG=mid print(OK)