結果
問題 | No.1007 コイン集め |
ユーザー | ikd |
提出日時 | 2020-05-04 23:37:21 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,041 bytes |
コンパイル時間 | 5,028 ms |
コンパイル使用メモリ | 161,540 KB |
実行使用メモリ | 41,544 KB |
最終ジャッジ日時 | 2023-09-07 09:00:39 |
合計ジャッジ時間 | 8,651 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
23,088 KB |
testcase_01 | AC | 60 ms
24,516 KB |
testcase_02 | AC | 73 ms
23,112 KB |
testcase_03 | AC | 59 ms
24,660 KB |
testcase_04 | AC | 73 ms
24,964 KB |
testcase_05 | AC | 74 ms
23,000 KB |
testcase_06 | AC | 74 ms
25,048 KB |
testcase_07 | AC | 75 ms
20,856 KB |
testcase_08 | AC | 77 ms
23,108 KB |
testcase_09 | AC | 74 ms
22,992 KB |
testcase_10 | AC | 72 ms
22,972 KB |
testcase_11 | AC | 73 ms
22,992 KB |
testcase_12 | AC | 126 ms
32,812 KB |
testcase_13 | AC | 134 ms
32,764 KB |
testcase_14 | AC | 129 ms
34,876 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 134 ms
39,664 KB |
testcase_19 | AC | 122 ms
40,132 KB |
testcase_20 | AC | 138 ms
41,544 KB |
testcase_21 | AC | 134 ms
41,252 KB |
コンパイルメッセージ
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(7,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 [<EntryPoint>] let main argv = let [| n; kk |] = stdin.ReadLine().Split() |> Array.map int let a = stdin.ReadLine().Split() |> Array.map int64 let k = kk - 1 if a.[k] = 0L then printfn "0" exit 0 let pa = a.[..(k - 1)] let sa = a.[(k + 1)..] let l = match pa |> Array.tryFindIndexBack (fun x -> x = 0L) with | Some i -> i + 1 | None -> match pa |> Array.tryFindIndexBack (fun x -> x = 1L) with | Some i -> i | None -> 0 let r = match sa |> Array.tryFindIndex (fun x -> x = 0L) with | Some i -> i + k | None -> match sa |> Array.tryFindIndex (fun x -> x = 1L) with | Some i -> i + k + 1 | None -> n - 1 if a.[k] = 1L then max (a.[l..k] |> Array.sum) (a.[k..r] |> Array.sum) |> printfn "%d" else a.[l..r] |> Array.sum |> printfn "%d" 0 // return an integer exit code