結果

問題 No.497 入れ子の箱
ユーザー letrangerjpletrangerjp
提出日時 2017-11-10 19:03:55
言語 Ruby
(3.3.0)
結果
AC  
実行時間 590 ms / 5,000 ms
コード長 229 bytes
コンパイル時間 40 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-05-03 12:13:06
合計ジャッジ時間 15,937 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
12,032 KB
testcase_01 AC 82 ms
12,160 KB
testcase_02 AC 76 ms
12,032 KB
testcase_03 AC 573 ms
12,416 KB
testcase_04 AC 578 ms
12,416 KB
testcase_05 AC 574 ms
12,672 KB
testcase_06 AC 574 ms
12,544 KB
testcase_07 AC 589 ms
12,416 KB
testcase_08 AC 584 ms
12,416 KB
testcase_09 AC 578 ms
12,672 KB
testcase_10 AC 579 ms
12,544 KB
testcase_11 AC 572 ms
12,544 KB
testcase_12 AC 522 ms
13,440 KB
testcase_13 AC 517 ms
13,184 KB
testcase_14 AC 508 ms
13,184 KB
testcase_15 AC 531 ms
13,440 KB
testcase_16 AC 536 ms
13,440 KB
testcase_17 AC 533 ms
13,312 KB
testcase_18 AC 570 ms
12,672 KB
testcase_19 AC 583 ms
12,672 KB
testcase_20 AC 575 ms
12,544 KB
testcase_21 AC 576 ms
12,672 KB
testcase_22 AC 590 ms
12,672 KB
testcase_23 AC 405 ms
12,544 KB
testcase_24 AC 413 ms
12,544 KB
testcase_25 AC 78 ms
12,032 KB
testcase_26 AC 75 ms
12,288 KB
testcase_27 AC 547 ms
13,184 KB
testcase_28 AC 547 ms
13,056 KB
testcase_29 AC 540 ms
13,056 KB
testcase_30 AC 465 ms
12,544 KB
testcase_31 AC 455 ms
12,288 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] ||= 1.+ (0...i).select{|j|
    A[j].zip(A[i]).all?{|a,b|a < b}
  }.map{|j|
    f(j)
  }.max || 0
end

p (0...N).map{|n|f(n)}.max
0