No.2982 Logic Battle
レベル :
/ AI推定難易度 : 1900
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 33
作問者 :
dyktr_06
/ テスター :
InTheBloom
タグ : / 解いたユーザー数 33
作問者 :
問題文最終更新日: 2024-11-24 16:45:43
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Advent Calendar Contest 2024
(順位表)
の他の問題:
Problem Statement
There is $1$ monster with $10^{100}$ health.
You will fight this monster in a battle of $N$ turns.
On turn $i \: (1 \leq i \leq N)$, you perform the following actions in order.
- Choose $1$ card from $3$ types of cards. If you choose the card of type $j$, your attack power increases by $A_{i,j}$. However, you cannot choose the card of the same type as the one you chose on the previous turn.
- Let $x$ be your current attack power. You deal $x$ damage. Immediately after that, your attack power changes to $\max(0, x - 1)$.
At the start of the battle, your attack power is $0$.
Find the maximum possible total damage you can deal to the monster.
Constraints
- $1 \leq N \leq 5000$
- $0 \leq A_{i, j} \leq 10^{9}$
- All inputs are integers.
Input
The input is given from standard input in the following format.
$N$
$A_{1,1}$ $A_{1,2}$ $A_{1,3}$
$\vdots$
$A_{N,1}$ $A_{N,2}$ $A_{N,3}$
Output
Output the answer to the problem on one line.
Sample
Sample 1
Input
3 1 3 1 4 10 2 7 12 5
Output
27
For example, acting as follows deals a total of $27$ damage.
- Turn $1$: Choose the card of type $3$, and your attack power becomes $1$. You deal $1$ damage to the monster. Immediately after that, your attack power becomes $0$.
- Turn $2$: Choose the card of type $2$, and your attack power becomes $10$. You deal $10$ damage to the monster. Immediately after that, your attack power becomes $9$.
- Turn $3$: Choose the card of type $1$, and your attack power becomes $16$. You deal $16$ damage to the monster. Immediately after that, your attack power becomes $15$.
Sample 2
Input
5 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0
Output
26
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。