結果

問題 No.168 ものさし
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-20 00:01:07
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,212 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 2,389 ms
コンパイル使用メモリ 77,244 KB
実行使用メモリ 112,540 KB
最終ジャッジ日時 2023-08-25 20:44:35
合計ジャッジ時間 11,782 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 319 ms
86,596 KB
testcase_01 AC 73 ms
76,504 KB
testcase_02 AC 72 ms
76,188 KB
testcase_03 AC 74 ms
76,340 KB
testcase_04 AC 74 ms
76,496 KB
testcase_05 AC 72 ms
76,480 KB
testcase_06 AC 72 ms
76,692 KB
testcase_07 AC 72 ms
76,456 KB
testcase_08 AC 71 ms
76,536 KB
testcase_09 AC 88 ms
79,228 KB
testcase_10 AC 110 ms
80,132 KB
testcase_11 AC 293 ms
85,700 KB
testcase_12 AC 863 ms
102,316 KB
testcase_13 AC 1,205 ms
112,308 KB
testcase_14 AC 1,199 ms
112,540 KB
testcase_15 AC 73 ms
76,312 KB
testcase_16 AC 87 ms
79,188 KB
testcase_17 AC 97 ms
79,104 KB
testcase_18 AC 132 ms
80,800 KB
testcase_19 AC 1,166 ms
110,664 KB
testcase_20 AC 1,212 ms
112,464 KB
testcase_21 AC 1,204 ms
112,276 KB
testcase_22 AC 1,201 ms
112,424 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 = 200000000

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 and ok==False:
        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