結果
問題 |
No.1045 直方体大学
|
ユーザー |
![]() |
提出日時 | 2020-05-01 22:53:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 802 bytes |
コンパイル時間 | 391 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 152,832 KB |
最終ジャッジ日時 | 2024-12-25 13:55:28 |
合計ジャッジ時間 | 32,670 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 2 TLE * 10 |
ソースコード
# 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)