結果

問題 No.818 Dinner time
ユーザー 双六
提出日時 2019-04-19 23:17:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-09-23 04:55:57
合計ジャッジ時間 7,050 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 8 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

def getlist():
	return list(map(int, input().split()))

N, M = getlist()

L = []
for i in range(N):
	ans = 0
	A, B = getlist()
	if 0 <= A and 0 <= B:
		if A < B:
			ans += (M - 1) * A + B
		else:
			ans += M * A
	elif A < 0 and 0 <= B:
		ans += B
	elif A < 0 and B < 0:
		if A * M < B:
			ans += B
		else:
			ans += A * M
	L.append(ans)

ANS = -float("inf")
val = 0
for i in range(N):
	val += L[i]
	if val > ANS:
		ANS = val

print(ANS)
0