結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,964 KB
testcase_01 AC 17 ms
7,972 KB
testcase_02 AC 17 ms
7,992 KB
testcase_03 AC 21 ms
8,404 KB
testcase_04 AC 22 ms
8,588 KB
testcase_05 AC 22 ms
8,516 KB
testcase_06 AC 22 ms
8,508 KB
testcase_07 AC 21 ms
8,444 KB
testcase_08 AC 22 ms
8,068 KB
testcase_09 AC 22 ms
8,044 KB
testcase_10 AC 21 ms
8,408 KB
testcase_11 AC 22 ms
8,444 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 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 165 ms
8,448 KB
testcase_24 AC 158 ms
8,012 KB
testcase_25 AC 17 ms
7,992 KB
testcase_26 AC 17 ms
8,052 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 184 ms
8,488 KB
testcase_31 AC 184 ms
8,412 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] = dp[j] + 1
                break

    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