結果
問題 | 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 sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesimport numpy as npfrom 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 = 0right = 10 ** 9 * 2while left + 1 < right:x = (left + right) // 2if test(x):right = xelse:left = xanswer = right + (-right) % 10print(answer)