結果
問題 | No.90 品物の並び替え |
ユーザー |
![]() |
提出日時 | 2018-04-29 23:20:24 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 70 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 18,560 KB |
最終ジャッジ日時 | 2024-06-27 23:43:27 |
合計ジャッジ時間 | 8,895 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 TLE * 1 |
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - m Syntax OK
ソースコード
first_row = gets.split.map(&:to_i) n = first_row[0] m = first_row[1] input = STDIN.read.split("\n") Criteria = Struct.new(:item1, :item2, :score) crt = [] input.each do |item| tmp = item.split.map!(&:to_i) str = Criteria.new(tmp[0], tmp[1], tmp[2]) crt << str end ans = 0 (0..(n - 1)).to_a.permutation do |i| tmp = 0 crt.each do |crt| if i.index(crt.item1) < i.index(crt.item2) tmp += crt.score end ans = [ans, tmp].max end end puts ans