結果

問題 No.3302 Sense Battle
ユーザー 回転
提出日時 2025-10-05 18:57:59
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 396 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 81,644 KB
最終ジャッジ日時 2025-10-05 18:58:04
合計ジャッジ時間 4,548 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 2 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
turn = []
for _ in range(N):
    a,b = list(map(int,input().split()))
    turn.append((a,b))

INF = 10**18
def f(n,atk):
    if(n == N):return 0 if atk == 0 else -INF

    # 攻撃しない
    ret = f(n+1,atk) + turn[n][0] * atk
    # 攻撃する
    ret = max(ret,f(n+1,atk-1) + turn[n][1])

    return ret

ans = 0
for i in range(1,N+1):
    ans = max(ans, f(0,i))
print(ans)
0