結果

問題 No.1007 コイン集め
ユーザー guriceringuricerin
提出日時 2020-03-06 23:09:54
言語 F#
(.NET 7)
結果
WA  
実行時間 -
コード長 1,392 bytes
コンパイル時間 5,848 ms
コンパイル使用メモリ 167,780 KB
実行使用メモリ 41,756 KB
最終ジャッジ日時 2023-08-04 12:48:27
合計ジャッジ時間 8,596 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
22,340 KB
testcase_01 AC 62 ms
24,376 KB
testcase_02 AC 61 ms
24,376 KB
testcase_03 AC 61 ms
24,408 KB
testcase_04 AC 60 ms
22,412 KB
testcase_05 AC 60 ms
22,316 KB
testcase_06 AC 61 ms
22,512 KB
testcase_07 AC 61 ms
22,440 KB
testcase_08 AC 61 ms
24,324 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 121 ms
33,080 KB
testcase_13 AC 122 ms
33,048 KB
testcase_14 AC 123 ms
37,140 KB
testcase_15 AC 103 ms
29,216 KB
testcase_16 AC 99 ms
31,220 KB
testcase_17 AC 99 ms
29,100 KB
testcase_18 AC 133 ms
41,756 KB
testcase_19 AC 130 ms
40,888 KB
testcase_20 WA -
testcase_21 AC 128 ms
39,212 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(23,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    let [| N; K |] = reada int
    let A = reada int64

    let A = Array.append [| 0L |] A
    let A = Array.append A [| 0L |]
    let mutable r = K
    let mutable ok = true
    while r < N && ok do
        if A.[r] <= 1L then ok <- false
        if ok then r <- r + 1

    let mutable l = K
    let mutable ok = true
    while l > 0 && ok do
        if A.[l] <= 1L then ok <- false
        if ok then l <- l - 1

    let ans = A.[l..r] |> Array.sum
    puts ans
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()
0