結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-23 08:01:34 |
| 言語 | Ruby (4.0.1) |
| 結果 |
AC
|
| 実行時間 | 3,953 ms / 5,000 ms |
| コード長 | 270 bytes |
| 記録 | |
| コンパイル時間 | 41 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 24,832 KB |
| 最終ジャッジ日時 | 2026-03-08 12:44:32 |
| 合計ジャッジ時間 | 5,767 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
# 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