結果

問題 No.168 ものさし
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-20 00:00:35
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,207 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 6,540 KB
実行使用メモリ 139,852 KB
最終ジャッジ日時 2023-08-25 20:42:41
合計ジャッジ時間 10,535 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 301 ms
34,632 KB
testcase_01 AC 11 ms
5,856 KB
testcase_02 AC 11 ms
5,960 KB
testcase_03 AC 10 ms
6,032 KB
testcase_04 AC 11 ms
5,936 KB
testcase_05 AC 11 ms
5,888 KB
testcase_06 AC 10 ms
6,088 KB
testcase_07 AC 11 ms
5,968 KB
testcase_08 AC 11 ms
5,888 KB
testcase_09 AC 19 ms
6,452 KB
testcase_10 AC 40 ms
8,568 KB
testcase_11 AC 251 ms
31,692 KB
testcase_12 AC 829 ms
98,016 KB
testcase_13 AC 1,188 ms
139,652 KB
testcase_14 AC 1,179 ms
139,668 KB
testcase_15 AC 11 ms
5,944 KB
testcase_16 AC 17 ms
6,296 KB
testcase_17 AC 29 ms
7,248 KB
testcase_18 AC 64 ms
11,188 KB
testcase_19 AC 1,135 ms
133,248 KB
testcase_20 AC 1,185 ms
139,724 KB
testcase_21 AC 1,207 ms
139,700 KB
testcase_22 AC 1,194 ms
139,852 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