結果

問題 No.168 ものさし
ユーザー noko2250noko2250
提出日時 2015-03-20 00:37:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 847,252 KB
最終ジャッジ日時 2023-09-11 08:57:42
合計ジャッジ時間 11,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 651 ms
268,636 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 79 ms
71,716 KB
testcase_04 AC 78 ms
71,508 KB
testcase_05 AC 79 ms
71,176 KB
testcase_06 AC 79 ms
71,552 KB
testcase_07 AC 78 ms
71,536 KB
testcase_08 AC 79 ms
71,528 KB
testcase_09 AC 111 ms
78,644 KB
testcase_10 AC 141 ms
85,204 KB
testcase_11 AC 487 ms
202,876 KB
testcase_12 MLE -
testcase_13 MLE -
testcase_14 AC 147 ms
95,488 KB
testcase_15 AC 79 ms
71,576 KB
testcase_16 AC 107 ms
78,424 KB
testcase_17 AC 140 ms
83,468 KB
testcase_18 AC 145 ms
86,220 KB
testcase_19 MLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/c/Python34/python
# coding: utf-8

import heapq, math

def dist(a, b, c, d):
    return math.sqrt((a-b)*(a-b)+(c-d)*(c-d))

def main():
    n = int(input())
    x, y = [0] * n, [0] * n
    for i in range(n):
        [x[i], y[i]] = map(int, input().split())

    L = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(i + 1, n):
            L[i][j] = L[j][i] = dist(x[i], x[j], y[i], y[j])

    q = [[0, [0]]]
    d = {}
    while len(q) > 0:
        e, v = heapq.heappop(q)
        t = v[-1]
        if t not in d:
            d[t] = True
            if t == n - 1:
                break
            for i in range(n):
                heapq.heappush(q, [max(L[t][i], e), v+[i]])

    print(int(e) + (10 - int(e) % 10))
    return

if __name__ == '__main__':
    main()
0