結果

問題 No.497 入れ子の箱
ユーザー rpy3cpprpy3cpp
提出日時 2017-03-25 18:31:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,678 ms / 5,000 ms
コード長 725 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 9,124 KB
最終ジャッジ日時 2023-09-20 10:42:09
合計ジャッジ時間 41,504 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,856 KB
testcase_01 AC 16 ms
7,952 KB
testcase_02 AC 16 ms
7,824 KB
testcase_03 AC 1,678 ms
8,900 KB
testcase_04 AC 1,662 ms
9,108 KB
testcase_05 AC 1,672 ms
9,056 KB
testcase_06 AC 1,675 ms
9,124 KB
testcase_07 AC 1,575 ms
9,004 KB
testcase_08 AC 1,570 ms
9,060 KB
testcase_09 AC 1,565 ms
9,096 KB
testcase_10 AC 1,566 ms
8,924 KB
testcase_11 AC 1,579 ms
9,100 KB
testcase_12 AC 1,403 ms
8,816 KB
testcase_13 AC 1,398 ms
8,792 KB
testcase_14 AC 1,389 ms
8,932 KB
testcase_15 AC 1,396 ms
8,776 KB
testcase_16 AC 1,402 ms
8,924 KB
testcase_17 AC 1,396 ms
8,788 KB
testcase_18 AC 1,617 ms
8,892 KB
testcase_19 AC 1,626 ms
9,040 KB
testcase_20 AC 1,622 ms
8,868 KB
testcase_21 AC 1,621 ms
8,864 KB
testcase_22 AC 1,628 ms
9,064 KB
testcase_23 AC 994 ms
8,864 KB
testcase_24 AC 1,003 ms
8,816 KB
testcase_25 AC 16 ms
7,748 KB
testcase_26 AC 16 ms
7,912 KB
testcase_27 AC 1,483 ms
8,856 KB
testcase_28 AC 1,492 ms
8,988 KB
testcase_29 AC 1,483 ms
8,972 KB
testcase_30 AC 1,233 ms
8,980 KB
testcase_31 AC 1,224 ms
8,828 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, (xx, yy, zz) in enumerate(xyz[:idx]):
            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