結果

問題 No.168 ものさし
ユーザー chocoruskchocorusk
提出日時 2020-09-14 09:45:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 652 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 8,496 KB
最終ジャッジ日時 2023-09-04 00:34:42
合計ジャッジ時間 5,455 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 225 ms
8,260 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 16 ms
7,888 KB
testcase_03 AC 14 ms
7,844 KB
testcase_04 AC 15 ms
7,992 KB
testcase_05 AC 15 ms
7,884 KB
testcase_06 AC 14 ms
7,912 KB
testcase_07 AC 15 ms
7,908 KB
testcase_08 AC 14 ms
7,796 KB
testcase_09 AC 21 ms
7,948 KB
testcase_10 AC 37 ms
7,816 KB
testcase_11 AC 201 ms
8,288 KB
testcase_12 AC 552 ms
8,392 KB
testcase_13 AC 629 ms
8,252 KB
testcase_14 AC 31 ms
8,232 KB
testcase_15 AC 16 ms
7,864 KB
testcase_16 AC 19 ms
7,872 KB
testcase_17 AC 28 ms
7,864 KB
testcase_18 AC 41 ms
7,908 KB
testcase_19 AC 652 ms
8,340 KB
testcase_20 AC 202 ms
8,496 KB
testcase_21 AC 625 ms
8,460 KB
testcase_22 AC 229 ms
8,360 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