結果

問題 No.818 Dinner time
ユーザー RyutaroYamauchi
提出日時 2019-04-25 17:20:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 28,228 KB
最終ジャッジ日時 2024-11-20 20:08:17
合計ジャッジ時間 49,712 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 2 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

A = []
B = []

N, M = map(int, input().strip().split(' '))

for i in range(N):
    a, b = map(int, input().strip().split(' '))
    A.append(a)
    B.append(b)

ans = 0

for k in range(N+1):
    score = 0
    for i in range(k):
        score += max(A[i] * M,
                     A[i] * (M - 1) + B[i],
                     B[i])
    max_score = score
    for i in range(k, N):
        score += max(A[i], B[i])
        if score > max_score:
            max_score = score
    if max_score > ans:
        ans = max_score

print(ans)
0