結果

問題 No.818 Dinner time
ユーザー convexineqconvexineq
提出日時 2021-03-23 07:07:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 252 bytes
コンパイル時間 2,320 ms
コンパイル使用メモリ 85,856 KB
実行使用メモリ 87,708 KB
最終ジャッジ日時 2023-08-16 10:39:00
合計ジャッジ時間 7,089 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,140 KB
testcase_01 AC 76 ms
71,180 KB
testcase_02 AC 77 ms
71,148 KB
testcase_03 AC 76 ms
71,388 KB
testcase_04 AC 75 ms
71,284 KB
testcase_05 AC 76 ms
71,164 KB
testcase_06 AC 75 ms
71,252 KB
testcase_07 AC 75 ms
71,404 KB
testcase_08 AC 75 ms
71,224 KB
testcase_09 WA -
testcase_10 AC 76 ms
71,148 KB
testcase_11 WA -
testcase_12 AC 76 ms
71,280 KB
testcase_13 AC 77 ms
71,228 KB
testcase_14 AC 78 ms
71,140 KB
testcase_15 AC 78 ms
71,344 KB
testcase_16 AC 76 ms
71,388 KB
testcase_17 AC 211 ms
87,140 KB
testcase_18 AC 175 ms
83,828 KB
testcase_19 AC 171 ms
83,896 KB
testcase_20 AC 190 ms
85,776 KB
testcase_21 AC 185 ms
85,392 KB
testcase_22 AC 196 ms
83,524 KB
testcase_23 AC 214 ms
85,028 KB
testcase_24 AC 229 ms
87,708 KB
testcase_25 AC 207 ms
84,192 KB
testcase_26 AC 199 ms
83,636 KB
testcase_27 AC 231 ms
86,404 KB
testcase_28 AC 209 ms
84,940 KB
testcase_29 AC 231 ms
87,196 KB
testcase_30 AC 212 ms
85,476 KB
testcase_31 AC 228 ms
86,436 KB
testcase_32 AC 177 ms
83,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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