結果

問題 No.168 ものさし
ユーザー gigurururugigurururu
提出日時 2015-04-01 21:32:31
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 420 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 11,432 KB
実行使用メモリ 47,812 KB
最終ジャッジ日時 2023-08-25 20:54:52
合計ジャッジ時間 16,070 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 552 ms
22,028 KB
testcase_01 AC 81 ms
15,024 KB
testcase_02 AC 81 ms
15,148 KB
testcase_03 AC 83 ms
15,092 KB
testcase_04 AC 82 ms
15,152 KB
testcase_05 AC 83 ms
15,260 KB
testcase_06 AC 79 ms
15,268 KB
testcase_07 AC 81 ms
15,116 KB
testcase_08 AC 80 ms
15,172 KB
testcase_09 AC 91 ms
15,156 KB
testcase_10 AC 119 ms
15,796 KB
testcase_11 AC 382 ms
21,876 KB
testcase_12 AC 1,084 ms
39,180 KB
testcase_13 AC 1,549 ms
47,416 KB
testcase_14 AC 1,501 ms
47,540 KB
testcase_15 AC 81 ms
15,264 KB
testcase_16 AC 90 ms
15,296 KB
testcase_17 AC 113 ms
15,348 KB
testcase_18 AC 179 ms
16,792 KB
testcase_19 AC 1,916 ms
47,280 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

UF=Hash.new{|_,k|k}
def u a,b;UF[f a]=UF[f b]end
def f c;c==UF[c]?c:UF[c]=f(UF[c])end

n=gets.to_i
l=(1..n).map{|i|[i]+gets.split.map(&:to_i)}
  .combination(2).map{|(i,ix,iy),(j,jx,jy)|[(ix-jx)**2+(iy-jy)**2,i,j]}
mn,mx=l.map(&:first).minmax
p (1..200000000).bsearch{|a|
  b=(a*10)**2
  if mn>b
    false
  elsif mx<=b
    true
  else
    UF.clear
    l.each{|d,i,j|
      u(i,j) if b>=d
    }
    f(1)==f(n)
  end
}*10
0