結果

問題 No.818 Dinner time
ユーザー RyutaroYamauchi
提出日時 2019-04-25 17:20:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 28,160 KB
最終ジャッジ日時 2024-11-20 20:06:25
合計ジャッジ時間 50,439 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
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):
    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