結果

問題 No.497 入れ子の箱
ユーザー Takashi MakinoTakashi Makino
提出日時 2017-04-15 14:23:10
言語 Python2
(2.7.18)
結果
AC  
実行時間 323 ms / 5,000 ms
コード長 754 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 6,348 KB
最終ジャッジ日時 2023-09-25 22:15:46
合計ジャッジ時間 9,753 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,048 KB
testcase_01 AC 11 ms
6,060 KB
testcase_02 AC 11 ms
6,004 KB
testcase_03 AC 321 ms
6,348 KB
testcase_04 AC 321 ms
6,268 KB
testcase_05 AC 323 ms
6,336 KB
testcase_06 AC 321 ms
6,200 KB
testcase_07 AC 321 ms
6,272 KB
testcase_08 AC 322 ms
6,300 KB
testcase_09 AC 322 ms
6,272 KB
testcase_10 AC 321 ms
6,272 KB
testcase_11 AC 322 ms
6,256 KB
testcase_12 AC 270 ms
6,284 KB
testcase_13 AC 267 ms
6,256 KB
testcase_14 AC 270 ms
6,256 KB
testcase_15 AC 270 ms
6,260 KB
testcase_16 AC 270 ms
6,256 KB
testcase_17 AC 267 ms
6,240 KB
testcase_18 AC 321 ms
6,184 KB
testcase_19 AC 321 ms
6,248 KB
testcase_20 AC 321 ms
6,264 KB
testcase_21 AC 319 ms
6,252 KB
testcase_22 AC 321 ms
6,264 KB
testcase_23 AC 181 ms
6,244 KB
testcase_24 AC 179 ms
6,348 KB
testcase_25 AC 11 ms
6,208 KB
testcase_26 AC 11 ms
6,148 KB
testcase_27 AC 288 ms
6,236 KB
testcase_28 AC 289 ms
6,244 KB
testcase_29 AC 287 ms
6,236 KB
testcase_30 AC 214 ms
6,300 KB
testcase_31 AC 213 ms
6,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8

def readData():
    n = input()
    box_list = []
    while len(box_list) != n:
        box = map(int, raw_input().split())
        box.sort()
        box_list.append(box)
    box_list.sort()
    return n, box_list

# box2のほうが大きければTrueを返す
def compare_box(box1, box2):
    for t in xrange(3):
        if box2[t] <= box1[t]:
            return False
    return True

def matryoshka(n, box_list):
    dp = [1] * n
    for i in xrange(n-2, -1, -1):
        for j in xrange(i+1, n):
            if compare_box(box_list[i], box_list[j]):
                dp[i] = max(dp[i], dp[j]+1)
    print max(dp)
    
if __name__ == "__main__":
    n, box_list = readData()
    matryoshka(n, box_list)
0