結果
問題 | No.1037 exhausted |
ユーザー | ikd |
提出日時 | 2020-05-02 14:48:17 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,491 bytes |
コンパイル時間 | 5,185 ms |
コンパイル使用メモリ | 174,584 KB |
実行使用メモリ | 60,256 KB |
最終ジャッジ日時 | 2023-08-28 17:46:06 |
合計ジャッジ時間 | 13,344 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 87 ms
23,012 KB |
testcase_03 | WA | - |
testcase_04 | AC | 89 ms
23,148 KB |
testcase_05 | WA | - |
testcase_06 | AC | 88 ms
22,988 KB |
testcase_07 | AC | 88 ms
23,196 KB |
testcase_08 | WA | - |
testcase_09 | AC | 88 ms
23,072 KB |
testcase_10 | AC | 87 ms
23,292 KB |
testcase_11 | AC | 88 ms
23,084 KB |
testcase_12 | AC | 621 ms
60,104 KB |
testcase_13 | AC | 635 ms
60,068 KB |
testcase_14 | AC | 618 ms
57,992 KB |
testcase_15 | AC | 622 ms
60,020 KB |
testcase_16 | AC | 623 ms
57,964 KB |
testcase_17 | AC | 637 ms
58,304 KB |
testcase_18 | AC | 639 ms
60,044 KB |
testcase_19 | AC | 622 ms
60,188 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved. /home/judge/data/code/Main.fs(22,18): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _; _|]' may indicate a case not covered by the pattern(s). /home/judge/data/code/Main.fs(18,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _; _|]' may indicate a case not covered by the pattern(s).
ソースコード
// Learn more about F# at http://fsharp.org open System type S = { X: int V: int W: int64 } let min a b = if a < b then a else b let max a b = if a > b then a else b [<EntryPoint>] let main argv = let [| n; v; l |] = stdin.ReadLine().Split() |> Array.map int let mutable stands = [| for i in 1 .. n -> (let [| x; v; w |] = stdin.ReadLine().Split() |> Array.map int { X = x V = v W = w |> int64 }) |] if stands.[0].X > 0 then stands <- Array.append [| { X = 0 V = 0 W = 0 |> int64 } |] stands if stands.[stands.Length - 1].X < l then stands <- Array.append stands [| { X = l V = 0 W = 0 |> int64 } |] let nn = stands.Length let inf = Int64.MaxValue / 2L let mutable dp = Array2D.create nn (v + 1) inf dp.[0, v] <- 0L for i = 1 to (nn - 1) do for j = 0 to v do let d = stands.[i].X - stands.[i - 1].X if j - d >= 0 then dp.[i, j - d] <- dp.[i - 1, j] for j = v downto 0 do let nj = min v (j + stands.[i].V) if nj > j then dp.[i, nj] <- min dp.[i, nj] (dp.[i, j] + stands.[i].W) // printfn "%A" dp // printfn "%A" stands printfn "%d" (dp.[nn - 1, *] |> Array.min) 0 // return an integer exit code