結果
問題 |
No.2982 Logic Battle
|
ユーザー |
|
提出日時 | 2024-12-14 00:01:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 954 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 77,776 KB |
最終ジャッジ日時 | 2024-12-14 00:01:10 |
合計ジャッジ時間 | 5,195 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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) + n: 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)