結果

問題 No.497 入れ子の箱
ユーザー smz_8110smz_8110
提出日時 2017-04-07 13:26:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 201 ms / 5,000 ms
コード長 309 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 11,248 KB
実行使用メモリ 15,464 KB
最終ジャッジ日時 2023-09-22 23:54:13
合計ジャッジ時間 7,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,112 KB
testcase_01 AC 78 ms
15,084 KB
testcase_02 AC 79 ms
15,296 KB
testcase_03 AC 193 ms
15,304 KB
testcase_04 AC 200 ms
15,256 KB
testcase_05 AC 197 ms
15,412 KB
testcase_06 AC 195 ms
15,300 KB
testcase_07 AC 195 ms
15,300 KB
testcase_08 AC 195 ms
15,124 KB
testcase_09 AC 199 ms
15,412 KB
testcase_10 AC 197 ms
15,364 KB
testcase_11 AC 198 ms
15,292 KB
testcase_12 AC 175 ms
15,220 KB
testcase_13 AC 173 ms
15,292 KB
testcase_14 AC 175 ms
15,464 KB
testcase_15 AC 176 ms
15,268 KB
testcase_16 AC 174 ms
15,268 KB
testcase_17 AC 172 ms
15,264 KB
testcase_18 AC 201 ms
15,396 KB
testcase_19 AC 199 ms
15,428 KB
testcase_20 AC 201 ms
15,364 KB
testcase_21 AC 198 ms
15,252 KB
testcase_22 AC 200 ms
15,252 KB
testcase_23 AC 127 ms
15,168 KB
testcase_24 AC 130 ms
15,364 KB
testcase_25 AC 81 ms
15,364 KB
testcase_26 AC 84 ms
15,272 KB
testcase_27 AC 182 ms
15,284 KB
testcase_28 AC 183 ms
15,216 KB
testcase_29 AC 183 ms
15,228 KB
testcase_30 AC 149 ms
15,256 KB
testcase_31 AC 150 ms
15,228 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a=gets.to_i.times.map{gets.split.map(&:to_i).sort}.sort{|a,b|b.inject(:*)<=>a.inject(:*)}
F=->a,i,l,m{
  r=0
  (a.size-1).downto(i){|j|
    v=a[j]
    if v[0]<l[0]&&v[1]<l[1]&&v[2]<l[2]
      q=j+1==a.size ? 1 : (m[j+1]||F[a,j+1,v,m])+1
      r=q if q>r
    end
  }
  m[i]=r
}
p F[a,0,[10**8,10**8,10**8],{}]
0