結果
問題 | No.1045 直方体大学 |
ユーザー | convexineq |
提出日時 | 2020-05-01 22:54:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 902 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 87,168 KB |
実行使用メモリ | 77,824 KB |
最終ジャッジ日時 | 2023-08-26 15:36:33 |
合計ジャッジ時間 | 7,335 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,424 KB |
testcase_01 | AC | 62 ms
71,232 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 601 ms
77,432 KB |
testcase_17 | AC | 75 ms
76,920 KB |
testcase_18 | AC | 258 ms
77,580 KB |
ソースコード
# 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 = 2**n ans = 0 for mask in range(N): res = [(0,0,0)] for i,(a,b,c) in enumerate(abc): if mask>>i&1: res.append((a,c,b)) else: res.append((a,b,c)) """ 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)