結果

問題 No.561 東京と京都
ユーザー ducktailducktail
提出日時 2018-01-01 21:13:35
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-12-22 23:53:59
合計ジャッジ時間 1,649 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (main args)
  (let* ([n (read)]
         [d (read)])
    (print
     (let loop ([c n]
                [tm 0]
                [km -1000000000])
       (cond [(zero? c) (max tm km)]
             [else (let* ([t (read)]
                          [k (read)])
                     (loop (- c 1)
                           (max
                            (+ tm t)
                            (- (+ km t) d))
                           (max
                            (+ km k)
                            (- (+ tm k) d))))]))))
  0)
0