結果

問題 No.2982 Logic Battle
ユーザー norioc
提出日時 2024-12-07 02:26:54
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 425 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 1,705,088 KB
最終ジャッジ日時 2024-12-07 02:28:30
合計ジャッジ時間 93,226 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 TLE * 3 MLE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
cards = []
for _ in range(N):
    A, B, C = map(int, input().split())
    cards.append((A, B, C))


dp = [(-1, 0, 0)]
for i in range(N):
    pp = []
    dp, pp = pp, dp
    for s, x, tot in pp:
        for j in range(3):
            if s == j: continue
            nx = x + cards[i][j]
            ntot = tot + nx
            dp.append((j, max(0, nx-1), ntot))

ans = max(tot for _, _, tot in dp)
print(ans)
0