結果
問題 |
No.1045 直方体大学
|
ユーザー |
![]() |
提出日時 | 2020-05-02 19:52:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 928 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 122,464 KB |
最終ジャッジ日時 | 2024-12-31 09:18:00 |
合計ジャッジ時間 | 7,458 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 WA * 6 |
ソースコード
import sys from operator import itemgetter readline = sys.stdin.readline def compress(L): L2 = list(set(L)) L2.sort() C = {v : k for k, v in enumerate(L2)} return L2, C N = int(readline()) Box = [] LL = [] for i in range(N): a, b, c = map(int, readline().split()) a, b, c = sorted([a, b, c]) LL.extend([c, c, b]) Box.append((i, 0, a, b, c)) Box.append((i, 1, b, a, c)) Box.append((i, 2, c, a, b)) Box.sort(key = itemgetter(3)) dp = [[0]*(3*N) for _ in range(1<<N)] for i, ori, point, _, w in Box: dp2 = dp[:] look = [] widx = 3*i+ori for j in range(3*N): if j != widx and LL[j] <= w: look.append(j) for S in range(1<<N): if not (1<<i) & S: continue T = S^(1<<i) res = 0 for j in look: res = max(res, dp[T][j]) dp[S][widx] = res + point print(max(max(d) for d in dp))