結果

問題 No.168 ものさし
ユーザー gigurururugigurururu
提出日時 2015-04-01 20:23:01
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 321 bytes
コンパイル時間 51 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 57,844 KB
最終ジャッジ日時 2023-09-17 00:45:10
合計ジャッジ時間 9,261 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 672 ms
28,976 KB
testcase_01 AC 79 ms
15,436 KB
testcase_02 AC 78 ms
15,480 KB
testcase_03 AC 79 ms
15,480 KB
testcase_04 AC 77 ms
15,452 KB
testcase_05 AC 75 ms
15,480 KB
testcase_06 AC 74 ms
15,508 KB
testcase_07 AC 79 ms
15,544 KB
testcase_08 AC 75 ms
15,448 KB
testcase_09 AC 88 ms
15,612 KB
testcase_10 AC 130 ms
16,512 KB
testcase_11 AC 596 ms
23,304 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
ans2=(1..n).map{|i|[i,Complex(*gets.split.map(&:to_i))]}
  .combination(2).map{|(i,ic),(j,jc)|[(ic-jc).abs2,i,j]}
  .sort.find{|d,i,j|
    u(i,j)
    f(1)==f(n)
  }[0]
ans=(ans2**0.5/10).ceil*10
p ans*ans<ans2 ?ans+10:ans
0