結果
問題 |
No.818 Dinner time
|
ユーザー |
![]() |
提出日時 | 2020-04-10 00:22:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 436 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 23,220 KB |
最終ジャッジ日時 | 2024-09-14 03:13:09 |
合計ジャッジ時間 | 5,842 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 WA * 2 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = map(int, readline().split()) m = map(int, read().split()) AB = zip(m, m) dp = [0, 0, 0] # 0回、1回、M回 for a, b in AB: newdp = [0, 0, 0] newdp[0] = max(dp) newdp[1] = max(dp[1:]) + max(a, b) full = a * (M - 1) + max(a, b) newdp[2] = dp[2] + max(full, b) dp = newdp print(max(dp))