結果

問題 No.561 東京と京都
ユーザー Ricky-yuRicky-yu
提出日時 2018-07-16 00:02:53
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-08-07 12:25:36
合計ジャッジ時間 1,609 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,896 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 15 ms
7,844 KB
testcase_04 AC 14 ms
7,812 KB
testcase_05 AC 15 ms
7,804 KB
testcase_06 AC 15 ms
7,804 KB
testcase_07 AC 15 ms
7,844 KB
testcase_08 AC 15 ms
7,904 KB
testcase_09 WA -
testcase_10 AC 15 ms
7,944 KB
testcase_11 WA -
testcase_12 AC 15 ms
7,796 KB
testcase_13 AC 15 ms
7,748 KB
testcase_14 AC 15 ms
7,860 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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