結果
| 問題 |
No.2982 Logic Battle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-13 23:49:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 905 bytes |
| コンパイル時間 | 320 ms |
| コンパイル使用メモリ | 82,472 KB |
| 実行使用メモリ | 154,516 KB |
| 最終ジャッジ日時 | 2024-12-13 23:49:53 |
| 合計ジャッジ時間 | 10,352 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 37 TLE * 1 |
ソースコード
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 = [[], [], []]
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 and c2 > c1: 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)