結果

問題 No.14 最小公倍数ソート
ユーザー gigurururugigurururu
提出日時 2014-11-28 17:21:50
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 246 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 11,580 KB
実行使用メモリ 317,368 KB
最終ジャッジ日時 2023-09-01 22:45:02
合計ジャッジ時間 9,171 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,216 KB
testcase_01 AC 82 ms
15,152 KB
testcase_02 AC 79 ms
15,048 KB
testcase_03 AC 1,166 ms
30,556 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets
a=gets.split.map(&:to_i)
lcm=a.map{[]}
a.size.times{|i|(i+1...a.size).each{|j|lcm[i][j]=lcm[j][i]=a[i].lcm(a[j])}}
idx=[*0...a.size]
a.size.times{|i|idx[i+1..-1]=idx[i+1..-1].sort_by{|j|[lcm[idx[i]][j],a[j]]}}
puts idx.map{|i|a[i]}*" "
0