結果

問題 No.497 入れ子の箱
ユーザー yuruhiyayuruhiya
提出日時 2020-09-06 18:39:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 481 ms / 5,000 ms
コード長 234 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 11,176 KB
実行使用メモリ 15,692 KB
最終ジャッジ日時 2023-08-19 14:14:00
合計ジャッジ時間 14,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,028 KB
testcase_01 AC 87 ms
15,132 KB
testcase_02 AC 80 ms
15,132 KB
testcase_03 AC 473 ms
15,512 KB
testcase_04 AC 481 ms
15,464 KB
testcase_05 AC 473 ms
15,304 KB
testcase_06 AC 477 ms
15,532 KB
testcase_07 AC 475 ms
15,692 KB
testcase_08 AC 478 ms
15,428 KB
testcase_09 AC 475 ms
15,524 KB
testcase_10 AC 473 ms
15,532 KB
testcase_11 AC 472 ms
15,540 KB
testcase_12 AC 464 ms
15,212 KB
testcase_13 AC 464 ms
15,384 KB
testcase_14 AC 467 ms
15,284 KB
testcase_15 AC 468 ms
15,272 KB
testcase_16 AC 464 ms
15,276 KB
testcase_17 AC 465 ms
15,368 KB
testcase_18 AC 479 ms
15,540 KB
testcase_19 AC 473 ms
15,672 KB
testcase_20 AC 476 ms
15,544 KB
testcase_21 AC 471 ms
15,524 KB
testcase_22 AC 475 ms
15,616 KB
testcase_23 AC 367 ms
15,404 KB
testcase_24 AC 367 ms
15,272 KB
testcase_25 AC 81 ms
15,136 KB
testcase_26 AC 80 ms
15,252 KB
testcase_27 AC 468 ms
15,428 KB
testcase_28 AC 471 ms
15,440 KB
testcase_29 AC 472 ms
15,408 KB
testcase_30 AC 455 ms
15,424 KB
testcase_31 AC 451 ms
15,484 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
xyz = (1..n).map { gets.split.map(&:to_i).sort }.sort.reverse

dp = [1] * n
(1...n).each { |i|
	dp[i] = ((0...i).select { |j|
		(0...3).all? { |k| xyz[i][k] < xyz[j][k] }
	}.map { |i| dp[i] }.max || 0) + 1
}
puts dp.max
0