結果

問題 No.168 ものさし
ユーザー roiti46roiti46
提出日時 2015-03-20 00:33:30
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 761 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 6,556 KB
実行使用メモリ 23,940 KB
最終ジャッジ日時 2023-09-11 08:57:08
合計ジャッジ時間 6,536 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import math
inf = 10**12
def dist(i,j):
    x1,y1 = XY[i]
    x2,y2 = XY[j]
    d = (x1-x2)**2+(y1-y2)**2
    if d-int(d**0.5)**2 > 0:
        return int(d**0.5)/10*10+10
    else:
        if int(d**0.5)%10 == 0:
            return int(d**0.5)
        else:
            return int(d**0.5)/10*10+10

N = int(raw_input())
XY = [map(int,raw_input().split()) for i in xrange(N)]
D = [[dist(i,j) for i in xrange(N)] for j in xrange(N)]
ans = inf
que = [[0,0]]
maxd = [inf]*N
maxd[0] = 0
while que:
    i,d = que.pop(0)
    if i == N-1:
        ans = min(ans,d)
        continue
    for j in xrange(N):
        if i == j: continue
        if D[i][j] < maxd[j] and d < maxd[j]:
            maxd[j] = max(d,D[i][j])
            que.append([j,max(d,D[i][j])])
print ans
0