結果

問題 No.1045 直方体大学
ユーザー convexineqconvexineq
提出日時 2020-05-01 22:53:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 802 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 81,944 KB
最終ジャッジ日時 2023-08-26 15:35:55
合計ジャッジ時間 5,721 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
75,984 KB
testcase_01 AC 74 ms
71,536 KB
testcase_02 AC 83 ms
76,640 KB
testcase_03 AC 86 ms
76,976 KB
testcase_04 WA -
testcase_05 AC 353 ms
77,380 KB
testcase_06 AC 343 ms
77,368 KB
testcase_07 AC 356 ms
77,348 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,m,s = [int(i) for i in readline().split()]
n = int(input())
abc = [tuple(sorted(int(i) for i in readline().split())) for _ in range(n)]

from bisect import *
def solve(lst,n):
    lst.sort()
    dp = [0]*(n+1) 
    for i,(w,h,c) in enumerate(lst):
        for j in range(i):
            if h > lst[j][1]:
                dp[i] = max(dp[i], dp[j]+c)
    #print(lst,dp)
    return max(dp)
#print(dp)
 

N = 3**n
ans = 0
for mask in range(N):
    res = [(0,0,0)]
    for i,(a,b,c) in enumerate(abc):
        v = mask%3
        mask //= 3
        if v==0: res.append((a,c,b))
        elif v==1: res.append((a,b,c))
        else: res.append((b,c,a))
    
    ans = max(ans,solve(res,n))    

print(ans)



0