結果
問題 |
No.519 アイドルユニット
|
ユーザー |
|
提出日時 | 2017-06-01 19:30:42 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 372 bytes |
コンパイル時間 | 68 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 43,040 KB |
最終ジャッジ日時 | 2024-09-21 21:41:29 |
合計ジャッジ時間 | 6,506 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 TLE * 6 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i $chemistory = [] N.times.each{|y| gets.split.take(N).map(&:to_i).each_with_index{|v, x| $chemistory[x] ||= [] $chemistory[x][y]= v } } $dp={} def g(unused) $dp[unused] ||= if unused.empty? 0 else a = unused.first (unused - [a]).inject(0){|r,b| [r, $chemistory[a][b] + g(unused - [a, b])].max } end end p g([*0...N])