結果

問題 No.168 ものさし
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-19 23:53:14
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,430 ms / 2,000 ms
コード長 853 bytes
コンパイル時間 1,756 ms
コンパイル使用メモリ 77,460 KB
実行使用メモリ 113,180 KB
最終ジャッジ日時 2023-08-25 20:42:56
合計ジャッジ時間 13,600 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 329 ms
86,832 KB
testcase_01 AC 70 ms
76,548 KB
testcase_02 AC 69 ms
76,552 KB
testcase_03 AC 69 ms
76,456 KB
testcase_04 AC 69 ms
76,396 KB
testcase_05 AC 71 ms
76,560 KB
testcase_06 AC 70 ms
76,456 KB
testcase_07 AC 71 ms
76,488 KB
testcase_08 AC 71 ms
76,712 KB
testcase_09 AC 92 ms
79,748 KB
testcase_10 AC 117 ms
80,196 KB
testcase_11 AC 314 ms
85,916 KB
testcase_12 AC 913 ms
102,524 KB
testcase_13 AC 1,430 ms
112,664 KB
testcase_14 AC 1,294 ms
112,488 KB
testcase_15 AC 70 ms
76,564 KB
testcase_16 AC 90 ms
79,488 KB
testcase_17 AC 105 ms
79,504 KB
testcase_18 AC 141 ms
81,008 KB
testcase_19 AC 1,189 ms
110,804 KB
testcase_20 AC 1,274 ms
113,180 KB
testcase_21 AC 1,274 ms
112,628 KB
testcase_22 AC 1,242 ms
112,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
P=[map(int,raw_input().split()) for i in range(N)]
edge=[[] for i in range(N)]
for i in range(N):
    for j in range(N):
        if i!=j:
            dx=P[i][0]-P[j][0]
            dy=P[i][1]-P[j][1]
            edge[i].append((dx*dx+dy*dy,j))
for i in range(N):
    edge[i].sort()

left = 0
right = 1000000000

while left+1 < right:
    mid=(left+right)/2
    dist=mid*10
    ok=False
    arrived=[False for i in range(N)]
    p=[0]
    arrived[0]=True
    while len(p)!=0:
        cur=p.pop()
        for d,nxt in edge[cur]:
            if d > dist*dist:
                break
            if arrived[nxt]:
                continue
            if nxt==N-1:
                ok=True
                break
            arrived[nxt]=True
            p.append(nxt)
    if ok:
        right = mid
    else:
        left=mid

print right*10
0