結果
問題 |
No.90 品物の並び替え
|
ユーザー |
![]() |
提出日時 | 2016-08-28 01:40:40 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 1,938 ms / 5,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 74,496 KB |
最終ジャッジ日時 | 2024-11-08 20:13:31 |
合計ジャッジ時間 | 4,287 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
n, m = gets.split.map(&:to_i) score_table = Array.new(n){ Array.new(n, 0) } m.times do i, j, s = gets.split.map(&:to_i) score_table[i][j] = s end max_score = 0 perm = (0..(n - 1)).to_a.permutation(n).to_a perm.each do |a| score = 0 n.times do |j| j.times do |i| score += score_table[a[i]][a[j]] end end max_score = [max_score, score].max end puts max_score