結果
問題 |
No.90 品物の並び替え
|
ユーザー |
![]() |
提出日時 | 2016-08-28 01:06:57 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 389 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 79,360 KB |
最終ジャッジ日時 | 2024-11-08 20:10:40 |
合計ジャッジ時間 | 2,429 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
n, m = gets.split.map(&:to_i) score_table = Array.new(n, Array.new(n, 0)) score_list = [] m.times do i, j, s = gets.split.map(&:to_i) score_table[i][j] = s end item_list = (0..(n - 1)).to_a permutation = item_list.permutation(n).to_a permutation.each do |a| score = 0 (n - 1).times do |k| score += score_table[a[k]][a[k + 1]] end score_list << score end puts score_list.max