結果

問題 No.818 Dinner time
ユーザー RyutaroYamauchi
提出日時 2019-04-25 17:11:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,948 KB
最終ジャッジ日時 2024-11-20 19:47:31
合計ジャッジ時間 50,555 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 9 WA * 4 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):
    score = 0
    for i in range(k):
        score += max(A[i] * M,
                     A[i] * (M - 1) + B[i],
                     B[i])
    max_score = 0
    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