結果

問題 No.561 東京と京都
ユーザー bellangeldindonbellangeldindon
提出日時 2019-04-25 16:52:43
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 439 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 20:11:14
合計ジャッジ時間 1,236 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 9 ms
6,940 KB
testcase_02 AC 10 ms
6,940 KB
testcase_03 AC 9 ms
6,940 KB
testcase_04 WA -
testcase_05 AC 9 ms
6,944 KB
testcase_06 AC 9 ms
6,940 KB
testcase_07 AC 8 ms
6,944 KB
testcase_08 AC 9 ms
6,940 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 9 ms
6,944 KB
testcase_13 AC 9 ms
6,944 KB
testcase_14 AC 9 ms
6,944 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def larger(xl, yl):
	if xl[1] > yl[1]: return xl
	else: return yl

N, D = map(int, raw_input().split())
salarylist = []
for i in range(0, N):
	salarylist.append(map(int, raw_input().split()))
dp = [[0, 0]]
for i in range(0, N):
	if dp[i][0] == 0:
		dp.append(larger([0, dp[i][1]+salarylist[i][0]], [1, dp[i][1]+salarylist[i][1]-D]))
	else: dp.append(larger([0, dp[i][1]+salarylist[i][0]-D], [1, dp[i][1]+salarylist[i][1]]))

print dp[N][1]
0