結果

問題 No.168 ものさし
ユーザー H3PO4H3PO4
提出日時 2020-08-11 21:23:43
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 133,912 KB
最終ジャッジ日時 2023-07-30 16:33:18
合計ジャッジ時間 15,236 ms
ジャッジサーバーID
(参考情報)
judge11 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 390 ms
56,396 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 245 ms
49,372 KB
testcase_04 AC 248 ms
49,452 KB
testcase_05 AC 245 ms
49,512 KB
testcase_06 AC 248 ms
49,316 KB
testcase_07 AC 248 ms
49,508 KB
testcase_08 AC 251 ms
49,264 KB
testcase_09 AC 254 ms
49,444 KB
testcase_10 AC 277 ms
49,480 KB
testcase_11 AC 423 ms
55,812 KB
testcase_12 AC 932 ms
75,872 KB
testcase_13 AC 1,336 ms
87,556 KB
testcase_14 AC 1,305 ms
87,708 KB
testcase_15 AC 244 ms
49,456 KB
testcase_16 AC 249 ms
49,676 KB
testcase_17 AC 251 ms
49,968 KB
testcase_18 AC 270 ms
50,060 KB
testcase_19 AC 702 ms
84,424 KB
testcase_20 AC 738 ms
85,860 KB
testcase_21 AC 757 ms
85,932 KB
testcase_22 AC 757 ms
133,912 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