結果

問題 No.497 入れ子の箱
ユーザー rpy3cpprpy3cpp
提出日時 2017-03-25 18:46:59
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,625 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 9,016 KB
最終ジャッジ日時 2023-09-20 10:44:30
合計ジャッジ時間 39,831 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,836 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 16 ms
7,836 KB
testcase_03 AC 1,625 ms
8,896 KB
testcase_04 AC 1,611 ms
8,940 KB
testcase_05 AC 1,608 ms
8,896 KB
testcase_06 AC 1,611 ms
9,004 KB
testcase_07 AC 1,532 ms
8,868 KB
testcase_08 AC 1,541 ms
8,896 KB
testcase_09 AC 1,540 ms
8,936 KB
testcase_10 AC 1,545 ms
9,016 KB
testcase_11 AC 1,544 ms
8,888 KB
testcase_12 AC 1,354 ms
8,864 KB
testcase_13 AC 1,353 ms
8,924 KB
testcase_14 AC 1,337 ms
8,756 KB
testcase_15 AC 1,346 ms
8,864 KB
testcase_16 AC 1,356 ms
8,752 KB
testcase_17 AC 1,345 ms
8,868 KB
testcase_18 AC 1,544 ms
8,840 KB
testcase_19 AC 1,543 ms
8,804 KB
testcase_20 AC 1,541 ms
8,888 KB
testcase_21 AC 1,541 ms
8,844 KB
testcase_22 AC 1,549 ms
8,836 KB
testcase_23 AC 939 ms
8,632 KB
testcase_24 AC 889 ms
8,880 KB
testcase_25 AC 15 ms
7,840 KB
testcase_26 AC 15 ms
7,932 KB
testcase_27 AC 1,437 ms
8,900 KB
testcase_28 AC 1,440 ms
8,876 KB
testcase_29 AC 1,438 ms
8,760 KB
testcase_30 AC 1,151 ms
8,808 KB
testcase_31 AC 1,152 ms
8,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def read_data():
    N = int(input())
    xyz = []
    for _ in range(N):
        x, y, z = map(int, input().split())
        xyz.append((x, y, z))
        xyz.append((x, z, y))
        xyz.append((y, x, z))
        xyz.append((y, z, x))
        xyz.append((z, x, y))
        xyz.append((z, y, x))
    return N, xyz

def solve(N, xyz):
    xyz.append((0, 0, 0))
    xyz.sort()
    dp = [0] * (N * 6 + 1)
    for idx, (x, y, z) in enumerate(xyz):
        tmp = 0
        for idx2 in range(idx):
            xx, yy, zz = xyz[idx2]
            if xx < x and yy < y and zz < z:
                if tmp < dp[idx2]:
                    tmp = dp[idx2]
        dp[idx] = tmp + 1
    return max(dp) - 1

N, xyz = read_data()
print(solve(N, xyz))
0