結果
問題 | No.14 最小公倍数ソート |
ユーザー | gigurururu |
提出日時 | 2014-12-30 20:15:26 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 201 bytes |
コンパイル時間 | 401 ms |
コンパイル使用メモリ | 11,316 KB |
実行使用メモリ | 205,368 KB |
最終ジャッジ日時 | 2023-09-03 20:18:14 |
合計ジャッジ時間 | 9,738 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
15,252 KB |
testcase_01 | AC | 68 ms
15,264 KB |
testcase_02 | AC | 69 ms
15,172 KB |
testcase_03 | AC | 1,150 ms
62,136 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
ソースコード
idx=*r=1...gets.to_i A=gets.split.map(&:to_i) MEMO={} def getLCM(a,b) MEMO[[a,b].sort]||=A[a].lcm A[b] end puts r.inject([0]){|s,|s+[idx.delete(idx.min_by{|i|[getLCM(s[-1],i),A[i]]})]}.map{|i|A[i]}*" "