結果
| 問題 |
No.2982 Logic Battle
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-12-07 03:38:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 687 bytes |
| コンパイル時間 | 274 ms |
| コンパイル使用メモリ | 82,288 KB |
| 実行使用メモリ | 801,376 KB |
| 最終ジャッジ日時 | 2024-12-07 03:39:32 |
| 合計ジャッジ時間 | 65,079 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 TLE * 5 MLE * 20 |
ソースコード
from heapq import heappush, heappop
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
ds = [{}, {}, {}]
for prev_j, x, tot in pp:
for j in range(3):
if prev_j == j: continue
nx = x + cards[i][j]
ntot = tot + nx
# dp.append((j, max(0, nx-1), ntot))
d = ds[j]
d[nx] = max(d.get(nx, -1), ntot)
for j in range(3):
d = ds[j]
for nx, ntot in d.items():
dp.append((j, max(0, nx-1), ntot))
ans = max(tot for _, _, tot in dp)
print(ans)
norioc