結果

問題 No.497 入れ子の箱
ユーザー letrangerjpletrangerjp
提出日時 2017-11-10 18:43:55
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 239 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-05-03 12:12:43
合計ジャッジ時間 14,447 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
12,160 KB
testcase_01 AC 78 ms
12,160 KB
testcase_02 AC 73 ms
12,288 KB
testcase_03 AC 552 ms
12,544 KB
testcase_04 AC 551 ms
12,544 KB
testcase_05 AC 561 ms
12,544 KB
testcase_06 AC 545 ms
12,416 KB
testcase_07 AC 550 ms
12,416 KB
testcase_08 AC 543 ms
12,672 KB
testcase_09 AC 549 ms
12,416 KB
testcase_10 AC 550 ms
12,544 KB
testcase_11 AC 555 ms
12,672 KB
testcase_12 AC 472 ms
12,544 KB
testcase_13 AC 491 ms
12,544 KB
testcase_14 AC 479 ms
12,672 KB
testcase_15 WA -
testcase_16 AC 458 ms
12,416 KB
testcase_17 AC 478 ms
12,416 KB
testcase_18 AC 559 ms
12,672 KB
testcase_19 AC 572 ms
12,544 KB
testcase_20 AC 556 ms
12,800 KB
testcase_21 AC 554 ms
12,672 KB
testcase_22 AC 554 ms
12,672 KB
testcase_23 AC 83 ms
12,416 KB
testcase_24 AC 82 ms
12,416 KB
testcase_25 AC 78 ms
12,160 KB
testcase_26 AC 75 ms
12,160 KB
testcase_27 AC 537 ms
12,544 KB
testcase_28 AC 515 ms
12,672 KB
testcase_29 AC 528 ms
12,544 KB
testcase_30 AC 85 ms
12,416 KB
testcase_31 AC 480 ms
12,672 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = $<.map{|s|s.split.map &:to_i}
A.map!{|a|a.sort}.sort!

$dp = {}
def f(i)
  $dp[i] ||= if i < 0
    0
  else
    (0...i).map{|j|
      1 + f(j) if A[j].zip(A[i]).all?{|a,b|a < b}
    }.compact.max || 1
  end
end

p f(N-1)
0