結果

問題 No.168 ものさし
ユーザー H3PO4H3PO4
提出日時 2020-08-11 21:23:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 447 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 153,796 KB
最終ジャッジ日時 2024-04-17 17:37:38
合計ジャッジ時間 6,899 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1,094 ms
61,748 KB
testcase_04 AC 1,086 ms
61,744 KB
testcase_05 AC 1,094 ms
61,744 KB
testcase_06 AC 1,104 ms
61,752 KB
testcase_07 AC 1,081 ms
61,484 KB
testcase_08 AC 1,099 ms
61,748 KB
testcase_09 AC 1,110 ms
61,628 KB
testcase_10 AC 1,113 ms
61,624 KB
testcase_11 AC 1,296 ms
66,892 KB
testcase_12 AC 1,955 ms
86,512 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,118 ms
61,496 KB
testcase_16 AC 1,089 ms
61,744 KB
testcase_17 AC 1,098 ms
61,740 KB
testcase_18 AC 1,121 ms
62,504 KB
testcase_19 AC 1,786 ms
96,152 KB
testcase_20 AC 1,791 ms
97,704 KB
testcase_21 AC 1,794 ms
97,348 KB
testcase_22 AC 1,811 ms
153,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.spatial import distance

N = int(input())
P = np.array([tuple(map(int, input().split())) for _ in range(N)])
D = distance.cdist(P, P)


def f(x):
    _, labels = connected_components(D < x)
    return labels[0] == labels[-1]


# bisect
l, r = 0, 2 * 10 ** 9
while r - l > 10:
    m = (r + l) // 20 * 10
    if f(m):
        r = m
    else:
        l = m
print(r)
0