結果

問題 No.497 入れ子の箱
ユーザー nanaenanae
提出日時 2017-03-25 00:28:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2023-09-20 07:21:32
合計ジャッジ時間 8,687 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,132 KB
testcase_01 AC 17 ms
8,152 KB
testcase_02 AC 17 ms
7,992 KB
testcase_03 AC 310 ms
8,420 KB
testcase_04 AC 313 ms
8,452 KB
testcase_05 AC 312 ms
8,396 KB
testcase_06 AC 310 ms
8,564 KB
testcase_07 AC 310 ms
8,464 KB
testcase_08 AC 309 ms
8,464 KB
testcase_09 AC 308 ms
8,608 KB
testcase_10 AC 309 ms
8,448 KB
testcase_11 AC 312 ms
8,532 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 304 ms
8,576 KB
testcase_21 AC 304 ms
8,412 KB
testcase_22 AC 305 ms
8,516 KB
testcase_23 AC 163 ms
8,128 KB
testcase_24 AC 158 ms
8,596 KB
testcase_25 AC 17 ms
8,124 KB
testcase_26 AC 17 ms
7,928 KB
testcase_27 AC 269 ms
8,516 KB
testcase_28 AC 269 ms
8,412 KB
testcase_29 AC 267 ms
8,396 KB
testcase_30 AC 184 ms
8,504 KB
testcase_31 AC 183 ms
8,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter

def solve():
    N = int(input())
    hako = [sorted([int(i) for i in input().split()]) for j in range(N)]
    hako.sort()

    inf = 10**9

    dp = [1] * N

    for i in range(N - 2, -1, -1):
        for j in range(i + 1, N):
            if is_larger(hako[i], hako[j]):
                dp[i] = max(dp[i], dp[j] + 1)

    ans = dp[0]

    print(ans)

def is_larger(a, b):
    for i in range(3):
        if b[i] <= a[i]:
            return False

    return True

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()
0