結果

問題 No.497 入れ子の箱
ユーザー lloyzlloyz
提出日時 2022-11-24 00:13:15
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 81,596 KB
実行使用メモリ 70,556 KB
最終ジャッジ日時 2023-10-25 08:22:42
合計ジャッジ時間 3,734 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,416 KB
testcase_01 AC 38 ms
53,416 KB
testcase_02 AC 38 ms
53,416 KB
testcase_03 AC 71 ms
68,472 KB
testcase_04 AC 72 ms
68,472 KB
testcase_05 AC 71 ms
68,472 KB
testcase_06 AC 70 ms
68,472 KB
testcase_07 AC 71 ms
68,472 KB
testcase_08 AC 71 ms
68,472 KB
testcase_09 AC 71 ms
68,472 KB
testcase_10 AC 71 ms
68,472 KB
testcase_11 AC 71 ms
68,472 KB
testcase_12 AC 82 ms
70,544 KB
testcase_13 AC 82 ms
70,544 KB
testcase_14 AC 82 ms
70,544 KB
testcase_15 AC 82 ms
70,544 KB
testcase_16 AC 82 ms
70,544 KB
testcase_17 AC 82 ms
70,544 KB
testcase_18 AC 76 ms
70,556 KB
testcase_19 AC 75 ms
70,556 KB
testcase_20 AC 75 ms
70,548 KB
testcase_21 AC 76 ms
70,548 KB
testcase_22 AC 76 ms
70,556 KB
testcase_23 AC 66 ms
66,408 KB
testcase_24 AC 64 ms
66,408 KB
testcase_25 AC 37 ms
53,416 KB
testcase_26 AC 38 ms
53,416 KB
testcase_27 AC 79 ms
70,556 KB
testcase_28 AC 81 ms
70,544 KB
testcase_29 AC 78 ms
70,556 KB
testcase_30 AC 72 ms
68,464 KB
testcase_31 AC 78 ms
70,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
H = []
for _ in range(n):
    L = list(map(int, input().split()))
    L.sort()
    H.append(L)
H.sort(key=lambda x: (x[0], x[1], x[2]))
DP = [0 for _ in range(n)]
DP[n - 1] = 1
for i in range(n - 2, -1, -1):
    res = 1
    xi, yi, zi = H[i]
    for j in range(i + 1, n):
        xj, yj, zj = H[j]
        if xi < xj and yi < yj and zi < zj:
            res = max(res, DP[j] + 1)
    DP[i] = res
print(max(DP))
0