結果
| 問題 | 
                            No.561 東京と京都
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-07-15 23:38:00 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 475 bytes | 
| コンパイル時間 | 484 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-11-07 13:07:23 | 
| 合計ジャッジ時間 | 1,989 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 2 | 
| other | AC * 6 WA * 11 | 
ソースコード
D_C = input().split()
Tokyo = True
Total = 0
for i in range(int(D_C[0])):
    money = input().split()
    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])
        else:
            Total += int(money[1])
print(Total)