結果

問題 No.168 ものさし
ユーザー titia
提出日時 2022-04-25 00:04:07
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 20,772 KB
最終ジャッジ日時 2024-06-26 10:50:23
合計ジャッジ時間 9,283 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 2 WA * 6 TLE * 2 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N=int(input())
P=[tuple(map(int,input().split())) for i in range(N)]

DP=[1<<60]*N
DP[0]=0

Q=[(0,0)]

while Q:
    dis,x=heapq.heappop(Q)

    if DP[x]!=dis:
        continue

    a,b=P[x]

    for i in range(N):
        c,d=P[i]

        d=(a-c)**2+(b-d)**2

        yy=int(d**(1/2))
        score=0

        for j in range(yy-5,yy+5):
            if j<=0:
                continue
            if j*j>=d:
                score=j
                break
        if DP[i]>max(score,DP[x]):
            DP[i]=max(score,DP[x])
            heapq.heappush(Q,(DP[i],i))

print(DP[-1]//10*10)
0