結果

問題 No.818 Dinner time
ユーザー convexineqconvexineq
提出日時 2021-03-23 06:42:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 250 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 88,088 KB
最終ジャッジ日時 2023-08-16 10:20:19
合計ジャッジ時間 6,790 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,352 KB
testcase_01 AC 72 ms
71,404 KB
testcase_02 AC 71 ms
71,316 KB
testcase_03 AC 73 ms
71,220 KB
testcase_04 WA -
testcase_05 AC 72 ms
71,172 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 72 ms
71,312 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 72 ms
71,332 KB
testcase_15 AC 74 ms
71,344 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

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), 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