結果
問題 |
No.2982 Logic Battle
|
ユーザー |
|
提出日時 | 2024-12-14 00:07:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 956 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 82,244 KB |
実行使用メモリ | 77,336 KB |
最終ジャッジ日時 | 2024-12-14 00:07:52 |
合計ジャッジ時間 | 4,947 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 25 |
ソースコード
n = int(input()) dp = [[(0, 0)], [(0, 0)], [(0, 0)]] # power = 0, deal_damage = 0 for turn 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 - turn): 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)