結果

問題 No.168 ものさし
ユーザー chocoruskchocorusk
提出日時 2020-09-14 09:45:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 76,680 KB
最終ジャッジ日時 2023-09-04 00:34:47
合計ジャッジ時間 3,757 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
76,564 KB
testcase_01 AC 70 ms
71,328 KB
testcase_02 AC 69 ms
71,072 KB
testcase_03 AC 70 ms
71,092 KB
testcase_04 AC 68 ms
71,280 KB
testcase_05 AC 70 ms
71,332 KB
testcase_06 AC 70 ms
71,300 KB
testcase_07 AC 71 ms
71,408 KB
testcase_08 AC 70 ms
71,208 KB
testcase_09 AC 82 ms
76,028 KB
testcase_10 AC 80 ms
75,880 KB
testcase_11 AC 88 ms
76,632 KB
testcase_12 AC 91 ms
76,548 KB
testcase_13 AC 93 ms
76,356 KB
testcase_14 AC 79 ms
76,584 KB
testcase_15 AC 70 ms
71,220 KB
testcase_16 AC 75 ms
76,124 KB
testcase_17 AC 80 ms
75,972 KB
testcase_18 AC 82 ms
75,988 KB
testcase_19 AC 98 ms
76,680 KB
testcase_20 AC 88 ms
76,456 KB
testcase_21 AC 107 ms
76,584 KB
testcase_22 AC 89 ms
76,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines
n=int(readline())
xy=list(map(int, read().split()))
x=xy[::2]
y=xy[1::2]
INF=3*10**18
d=[INF]*n
d[0]=0
dq=[INF]*n
dq[0]=0
for _ in range(n):
    i=dq.index(min(dq))
    d1=dq[i]
    if i==n-1 or d1==INF:
        break
    x1, y1=x[i], y[i]
    dq[i]=INF
    for j, (x2, y2) in enumerate(zip(x, y)):
        d2=max(d1, (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
        if d[j]>d2:
            d[j]=d2
            if dq[j]>d2:
                dq[j]=d2
mn=d[n-1]
l, r=0, 2*10**8
while r-l>1:
    m=(l+r)//2
    if 100*m*m>=mn:
        r=m
    else:
        l=m
print(10*r)
0