結果
問題 |
No.2982 Logic Battle
|
ユーザー |
|
提出日時 | 2024-12-13 23:56:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 950 bytes |
コンパイル時間 | 327 ms |
コンパイル使用メモリ | 82,000 KB |
実行使用メモリ | 77,356 KB |
最終ジャッジ日時 | 2024-12-13 23:57:02 |
合計ジャッジ時間 | 5,244 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 25 |
ソースコード
n = int(input()) dp = [[(0, 0)], [(0, 0)], [(0, 0)]] # power = 0, deal_damage = 0 for _ in range(n): a = list(map(int, input().split())) pre = [[], [], []] for i in range(3): for s, c in dp[i]: power = s + a[i] for j in range(3): if i == j: continue pre[j].append((max(0, power - 1), c + power)) nxt = [[], [], []] # s1, c1 : s2, c2 # for i in range(3): for p in range(len(pre[i])): add = True for q in range(len(pre[i])): if p == q: continue s1, c1 = pre[i][p] s2, c2 = pre[i][q] if p >= q and s1 == s2 and c1 == c2: add = False if (s2 - s1) > (c1 - c2) * (n - i): add = False if add: nxt[i].append(pre[i][p]) dp = nxt[::] ans = 0 for i in range(3): for p, c in dp[i]: ans = max(ans, c) print(ans)