結果

問題 No.497 入れ子の箱
ユーザー ikdikd
提出日時 2017-03-25 19:04:42
言語 Ruby
(3.3.0)
結果
AC  
実行時間 180 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 15,340 KB
最終ジャッジ日時 2023-09-20 10:45:17
合計ジャッジ時間 6,125 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,176 KB
testcase_01 AC 77 ms
15,252 KB
testcase_02 AC 78 ms
15,036 KB
testcase_03 AC 171 ms
15,328 KB
testcase_04 AC 175 ms
15,292 KB
testcase_05 AC 171 ms
15,088 KB
testcase_06 AC 170 ms
15,288 KB
testcase_07 AC 171 ms
15,292 KB
testcase_08 AC 173 ms
15,328 KB
testcase_09 AC 172 ms
15,176 KB
testcase_10 AC 172 ms
15,316 KB
testcase_11 AC 172 ms
15,276 KB
testcase_12 AC 160 ms
15,036 KB
testcase_13 AC 158 ms
15,088 KB
testcase_14 AC 159 ms
15,280 KB
testcase_15 AC 159 ms
15,280 KB
testcase_16 AC 158 ms
15,304 KB
testcase_17 AC 161 ms
15,136 KB
testcase_18 AC 173 ms
15,252 KB
testcase_19 AC 174 ms
15,328 KB
testcase_20 AC 175 ms
15,276 KB
testcase_21 AC 177 ms
15,176 KB
testcase_22 AC 180 ms
15,124 KB
testcase_23 AC 122 ms
15,300 KB
testcase_24 AC 124 ms
15,080 KB
testcase_25 AC 80 ms
15,340 KB
testcase_26 AC 80 ms
15,044 KB
testcase_27 AC 164 ms
15,144 KB
testcase_28 AC 168 ms
15,304 KB
testcase_29 AC 163 ms
15,320 KB
testcase_30 AC 144 ms
15,176 KB
testcase_31 AC 145 ms
15,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
data=[]
n.times do
    d=gets.split.map(&:to_i).sort
    data<< d
end

data.sort!{|a, b|a[0]<=>b[0]}
memo=[]
n.times do |i|
    d=data[i]+[0]
    memo.size.times do |j|
        _d=memo[j]
        d[3]=[d[3], _d[3]+1].max if _d[0]<d[0]&&_d[1]<d[1]&&_d[2]<d[2]
    end
    memo<< d
end

a=0
memo.each do |e|
    a=[a, e[3]].max
end

puts a+1
0