結果

問題 No.497 入れ子の箱
ユーザー nanae
提出日時 2017-03-25 00:28:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-07-06 03:18:38
合計ジャッジ時間 7,990 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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