結果

問題 No.818 Dinner time
ユーザー convexineqconvexineq
提出日時 2021-03-23 08:04:16
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 77,828 KB
最終ジャッジ日時 2023-08-16 11:19:04
合計ジャッジ時間 6,169 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,156 KB
testcase_01 AC 71 ms
71,204 KB
testcase_02 AC 72 ms
71,368 KB
testcase_03 AC 72 ms
71,176 KB
testcase_04 AC 71 ms
71,116 KB
testcase_05 AC 72 ms
71,180 KB
testcase_06 AC 71 ms
71,304 KB
testcase_07 AC 72 ms
71,372 KB
testcase_08 AC 76 ms
71,248 KB
testcase_09 AC 71 ms
71,312 KB
testcase_10 AC 72 ms
71,212 KB
testcase_11 AC 71 ms
71,160 KB
testcase_12 AC 71 ms
71,208 KB
testcase_13 AC 72 ms
71,164 KB
testcase_14 AC 72 ms
71,276 KB
testcase_15 AC 72 ms
71,348 KB
testcase_16 AC 72 ms
71,252 KB
testcase_17 AC 151 ms
77,316 KB
testcase_18 AC 134 ms
77,344 KB
testcase_19 AC 132 ms
77,244 KB
testcase_20 AC 143 ms
77,132 KB
testcase_21 AC 137 ms
77,524 KB
testcase_22 AC 150 ms
77,412 KB
testcase_23 AC 159 ms
77,720 KB
testcase_24 AC 175 ms
77,544 KB
testcase_25 AC 159 ms
77,828 KB
testcase_26 AC 150 ms
77,616 KB
testcase_27 AC 167 ms
77,776 KB
testcase_28 AC 154 ms
77,408 KB
testcase_29 AC 170 ms
77,760 KB
testcase_30 AC 161 ms
77,608 KB
testcase_31 AC 166 ms
77,608 KB
testcase_32 AC 137 ms
77,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
X,Y,Z = [0,-10**18,-10**18]
for _ in range(n):
    a,b = map(int,input().split())
    x = a*m
    y = a*(m-1) + b
    if _ == 0:
        X = max(x,y,b)
        continue
    X,Y,Z = X+max(x,y,b), max(X,Y)+max(a,b), max(X,Y,Z)
print(max(X,Y,Z))
0