結果

問題 No.561 東京と京都
ユーザー Ricky-yuRicky-yu
提出日時 2018-07-16 00:04:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-08-07 12:30:09
合計ジャッジ時間 1,875 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,824 KB
testcase_01 AC 15 ms
7,836 KB
testcase_02 AC 15 ms
7,848 KB
testcase_03 AC 15 ms
7,756 KB
testcase_04 AC 15 ms
7,840 KB
testcase_05 AC 15 ms
7,756 KB
testcase_06 AC 14 ms
7,844 KB
testcase_07 AC 15 ms
7,792 KB
testcase_08 AC 14 ms
7,760 KB
testcase_09 WA -
testcase_10 AC 15 ms
7,868 KB
testcase_11 WA -
testcase_12 AC 15 ms
7,800 KB
testcase_13 AC 15 ms
7,832 KB
testcase_14 AC 16 ms
7,840 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from __future__ import absolute_import
from __future__ import unicode_literals

D_C = input().split()
Tokyo = True
Total = 0
Tokyo_money = 0
Kyoto_money = 0-int(D_C[1])
for i in range(int(D_C[0])):
    money = input().split()
    Tokyo_money += int(money[0])
    Kyoto_money += int(money[1])
    if Tokyo:
       if int(money[0]) < int(money[1])-int(D_C[1]):
            Tokyo = False
            Total += int(money[1])-int(D_C[1])
       else:
           Total += int(money[0])
    else:
        if int(money[1]) < int(money[0])-int(D_C[1]):
            Tokyo = True
            Total += int(money[0])-int(D_C[1])
        else:
            Total += int(money[1])


    if Kyoto_money > Total:
        Total = Kyoto_money
    elif Tokyo_money > Total:
        Total = Tokyo_money

print(Total)
0