結果
問題 |
No.168 ものさし
|
ユーザー |
![]() |
提出日時 | 2020-03-07 06:02:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 732 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 161,720 KB |
最終ジャッジ日時 | 2024-10-14 11:14:53 |
合計ジャッジ時間 | 31,546 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 TLE * 2 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import connected_components # %% N = int(readline()) XY = np.array(read().split(), np.int64) X = XY[::2] Y = XY[1::2] # %% dx = X[:, None] - X[None, :] dy = Y[:, None] - Y[None, :] dist_mat = dx**2 + dy**2 # %% def test(x): graph = dist_mat <= x * x _, comp = connected_components(graph, directed=False) return comp[0] == comp[-1] # %% left = 0 right = 10 ** 9 * 2 while left + 1 < right: x = (left + right) // 2 if test(x): right = x else: left = x answer = right + (-right) % 10 print(answer)