結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2022-12-26 23:01:19 |
言語 | Ruby (3.4.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 66 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 19,712 KB |
最終ジャッジ日時 | 2024-11-21 09:59:36 |
合計ジャッジ時間 | 7,917 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 TLE * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
def scoring(seq) hash = {}.tap do |h| seq.each_with_index do |elem, index| h[elem] = index end end I.sum do |l, r, s| hash[l] < hash[r] ? s : 0 end end N, M = gets.split.map(&:to_i) I = (1..M).map { gets.split.map(&:to_i) } puts Array.new(N) { |index| index }.permutation.map { |seq| scoring(seq) }.max