結果

問題 No.2354 Poor Sight in Winter
ユーザー titiatitia
提出日時 2023-06-17 01:32:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 728 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 83,612 KB
最終ジャッジ日時 2023-09-07 00:42:39
合計ジャッジ時間 19,338 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,608 KB
testcase_01 AC 76 ms
71,548 KB
testcase_02 AC 76 ms
71,224 KB
testcase_03 RE -
testcase_04 AC 77 ms
71,384 KB
testcase_05 RE -
testcase_06 AC 77 ms
71,180 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 92 ms
76,204 KB
testcase_11 AC 405 ms
80,288 KB
testcase_12 AC 386 ms
80,664 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,286 ms
80,732 KB
testcase_16 AC 1,632 ms
80,744 KB
testcase_17 AC 1,523 ms
81,396 KB
testcase_18 AC 637 ms
80,672 KB
testcase_19 AC 1,289 ms
80,804 KB
testcase_20 AC 705 ms
80,912 KB
testcase_21 AC 202 ms
79,224 KB
testcase_22 AC 412 ms
79,880 KB
testcase_23 AC 407 ms
80,268 KB
testcase_24 AC 899 ms
81,172 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 196 ms
78,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)

            
0