結果
問題 | No.168 ものさし |
ユーザー |
![]() |
提出日時 | 2022-07-24 13:12:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 549 ms / 2,000 ms |
コード長 | 801 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 82,320 KB |
実行使用メモリ | 271,852 KB |
最終ジャッジ日時 | 2024-07-06 07:25:26 |
合計ジャッジ時間 | 4,525 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
from collections import dequedef check(x):G = [[] for _ in range(N)]for i in range(N):for j in range(i+1,N):d = (X[i]-X[j])**2 + (Y[i]-Y[j])**2if d <= x:G[i].append(j)G[j].append(i)flg = [False] * Nflg[0] = TrueQueue = deque()Queue.append(0)while Queue:pos = Queue.popleft()for nxt in G[pos]:if flg[nxt]:continueflg[nxt] = TrueQueue.append(nxt)return flg[-1]N = int(input())Z = [list(map(int,input().split())) for _ in range(N)]X,Y = [list(i) for i in zip(*Z)]ng = 0ok = 1<<32while ok - ng > 1:x = (ok+ng) // 2if check(x**2):ok = xelse:ng = xok = (ok + 9) // 10 * 10print(ok)