結果

問題 No.497 入れ子の箱
ユーザー nanaenanae
提出日時 2017-03-24 23:58:58
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 71,464 KB
最終ジャッジ日時 2023-09-20 06:11:02
合計ジャッジ時間 16,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 OLE -
testcase_04 OLE -
testcase_05 OLE -
testcase_06 OLE -
testcase_07 OLE -
testcase_08 OLE -
testcase_09 OLE -
testcase_10 OLE -
testcase_11 OLE -
testcase_12 OLE -
testcase_13 OLE -
testcase_14 OLE -
testcase_15 OLE -
testcase_16 OLE -
testcase_17 OLE -
testcase_18 OLE -
testcase_19 OLE -
testcase_20 OLE -
testcase_21 OLE -
testcase_22 OLE -
testcase_23 OLE -
testcase_24 OLE -
testcase_25 AC 89 ms
71,268 KB
testcase_26 AC 77 ms
71,260 KB
testcase_27 OLE -
testcase_28 OLE -
testcase_29 OLE -
testcase_30 OLE -
testcase_31 OLE -
権限があれば一括ダウンロードができます

ソースコード

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(key=itemgetter(2))
    hako.sort(key=itemgetter(1))
    hako.sort(key=itemgetter(0))

    inf = 10**9

    dp = [[inf, inf, inf] for i in range(N)]
    dp[0] = hako[0]

    for i in range(1, N):
        for j in range(N):
            if not is_larger(dp[j], hako[i]):
                if is_larger(hako[i], dp[j]):
                    dp[j] = hako[i]

                break

        print(dp)

    ans = len([tyoku for tyoku in dp if tyoku != [inf]*3])
    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