結果

問題 No.94 圏外です。(EASY)
ユーザー gigurururugigurururu
提出日時 2014-12-07 23:03:04
言語 Ruby
(3.3.0)
結果
AC  
実行時間 653 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 11,296 KB
実行使用メモリ 31,456 KB
最終ジャッジ日時 2023-09-08 14:17:44
合計ジャッジ時間 8,576 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,264 KB
testcase_01 AC 82 ms
15,108 KB
testcase_02 AC 84 ms
15,304 KB
testcase_03 AC 83 ms
15,160 KB
testcase_04 AC 92 ms
15,468 KB
testcase_05 AC 106 ms
15,916 KB
testcase_06 AC 138 ms
16,424 KB
testcase_07 AC 202 ms
17,844 KB
testcase_08 AC 322 ms
20,984 KB
testcase_09 AC 531 ms
27,188 KB
testcase_10 AC 535 ms
27,432 KB
testcase_11 AC 531 ms
27,068 KB
testcase_12 AC 535 ms
27,196 KB
testcase_13 AC 537 ms
27,292 KB
testcase_14 AC 536 ms
27,612 KB
testcase_15 AC 537 ms
27,424 KB
testcase_16 AC 540 ms
27,776 KB
testcase_17 AC 535 ms
27,568 KB
testcase_18 AC 537 ms
27,396 KB
testcase_19 AC 653 ms
31,456 KB
testcase_20 AC 86 ms
15,132 KB
testcase_21 AC 82 ms
15,316 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

l=(1..n=gets.to_i).map{Complex(*gets.split.map(&:to_i))}
d=(0...n).map{|i|(0...n).map{|j|(l[i]-l[j]).abs}}
$u=*0...n
def f n;n==$u[n]?n:$u[n]=f($u[n])end
n.times{|i|(i+1...n).each{|j|$u[f i]=$u[f j] if d[i][j]<=10}}
n.times{|i|f i}
p ($u.each.with_index.group_by{|a,i|a}.map{|k,v|v.map{|_,i|i}.combination(2).map{|i,j|d[i][j]}.max||0}.max||-1)+2
0