結果

問題 No.168 ものさし
ユーザー titiatitia
提出日時 2022-04-25 00:04:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 13,928 KB
最終ジャッジ日時 2023-09-08 18:04:03
合計ジャッジ時間 18,196 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
8,080 KB
testcase_02 AC 16 ms
8,036 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
8,076 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
権限があれば一括ダウンロードができます

ソースコード

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