結果

問題 No.561 東京と京都
ユーザー Nobita Gomu
提出日時 2017-09-21 14:23:42
言語 F#
(F# 4.0)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 6,610 ms
コンパイル使用メモリ 207,964 KB
実行使用メモリ 34,904 KB
最終ジャッジ日時 2024-11-08 19:24:11
合計ジャッジ時間 14,808 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (229 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let f (s:string) =
    s.Split ' '
    |> Array.map int
    |> fun (a:int[]) -> (a.[0], a.[1])

type Buf = {
    mutable tm: int
    mutable km: int
    d: int
} with
    member this.max = max this.tm this.km
    member this.update(s:string) =
        let (tm, km) =
            s
            |> f
            |> fun (t:int, k:int) ->
                (t + (max this.tm (this.km - this.d)),
                 k + (max (this.tm - this.d) this.km))
        this.tm <- tm
        this.km <- km

let (n, d) = stdin.ReadLine () |> f
let (t, k) = stdin.ReadLine () |> f
let b:Buf = { tm = t; km = k - d; d = d }

seq { for _ in 1..n-1 -> stdin.ReadLine () }
    |> Seq.iter (fun s -> b.update(s))

b.max |> printfn "%d"
0