結果
問題 | No.90 品物の並び替え |
ユーザー | akko_yukky |
提出日時 | 2018-04-29 23:31:01 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 409 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 11,552 KB |
実行使用メモリ | 15,964 KB |
最終ジャッジ日時 | 2023-09-10 08:14:35 |
合計ジャッジ時間 | 8,982 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
15,132 KB |
testcase_01 | AC | 499 ms
15,776 KB |
testcase_02 | AC | 79 ms
15,272 KB |
testcase_03 | AC | 105 ms
15,668 KB |
testcase_04 | AC | 123 ms
15,776 KB |
testcase_05 | AC | 571 ms
15,724 KB |
testcase_06 | AC | 410 ms
15,964 KB |
testcase_07 | AC | 84 ms
15,456 KB |
testcase_08 | AC | 80 ms
15,128 KB |
testcase_09 | TLE | - |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets[0].to_i input = STDIN.read.split("\n") Criteria = Struct.new(:item1, :item2, :score) crt = [] input.each do |item| tmp = item.split.map!(&:to_i) crt << Criteria.new(tmp[0], tmp[1], tmp[2]) 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