結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
akko_yukky
|
| 提出日時 | 2018-04-29 23:31:01 |
| 言語 | Ruby (4.0.1) |
| 結果 |
AC
|
| 実行時間 | 4,104 ms / 5,000 ms |
| コード長 | 409 bytes |
| 記録 | |
| コンパイル時間 | 267 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 16,000 KB |
| 最終ジャッジ日時 | 2026-03-16 05:46:40 |
| 合計ジャッジ時間 | 6,543 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
コンパイルメッセージ
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
akko_yukky