結果

問題 No.90 品物の並び替え
ユーザー gemmarogemmaro
提出日時 2020-07-23 08:01:34
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 270 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 11,444 KB
実行使用メモリ 30,540 KB
最終ジャッジ日時 2023-09-05 20:17:12
合計ジャッジ時間 9,014 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,140 KB
testcase_01 AC 508 ms
22,796 KB
testcase_02 AC 82 ms
15,072 KB
testcase_03 AC 107 ms
16,384 KB
testcase_04 AC 125 ms
17,088 KB
testcase_05 AC 578 ms
22,824 KB
testcase_06 AC 419 ms
19,196 KB
testcase_07 AC 85 ms
15,588 KB
testcase_08 AC 81 ms
15,100 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

class Array
  def score
    I.map { |l, r, s| index(l) < index(r) ? s : 0 }.sum
  end
end

def solve
  (0..(N - 1)).to_a.permutation.map(&:score).max
end

N, M = gets.split.map(&:to_i)
I = M.times.map { gets.split.map(&:to_i) }

puts solve
0