結果

問題 No.2982 Logic Battle
コンテスト
ユーザー norioc
提出日時 2024-12-07 02:26:54
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
MLE  
実行時間 -
コード長 425 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 64 ms
コンパイル使用メモリ 81,952 KB
実行使用メモリ 1,338,092 KB
最終ジャッジ日時 2026-10-03 02:05:56
合計ジャッジ時間 5,438 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 MLE * 2 -- * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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