結果
問題 | No.90 品物の並び替え |
ユーザー | gemmaro |
提出日時 | 2022-12-26 23:01:19 |
言語 | Ruby (3.3.0) |
結果 |
AC
|
実行時間 | 4,747 ms / 5,000 ms |
コード長 | 331 bytes |
コンパイル時間 | 60 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 19,712 KB |
最終ジャッジ日時 | 2024-05-01 07:17:34 |
合計ジャッジ時間 | 7,344 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 77 ms
12,288 KB |
testcase_01 | AC | 402 ms
12,800 KB |
testcase_02 | AC | 82 ms
12,160 KB |
testcase_03 | AC | 105 ms
12,544 KB |
testcase_04 | AC | 114 ms
12,672 KB |
testcase_05 | AC | 428 ms
12,928 KB |
testcase_06 | AC | 336 ms
12,928 KB |
testcase_07 | AC | 78 ms
12,288 KB |
testcase_08 | AC | 77 ms
12,288 KB |
testcase_09 | AC | 4,747 ms
19,712 KB |
コンパイルメッセージ
Syntax OK
ソースコード
def scoring(seq) hash = {}.tap do |h| seq.each_with_index do |elem, index| h[elem] = index end end I.sum do |l, r, s| hash[l] < hash[r] ? s : 0 end end N, M = gets.split.map(&:to_i) I = (1..M).map { gets.split.map(&:to_i) } puts Array.new(N) { |index| index }.permutation.map { |seq| scoring(seq) }.max