結果

問題 No.989 N×Mマス計算(K以上)
ユーザー ikdikd
提出日時 2020-06-06 22:36:31
言語 F#
(F# 4.0)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 873 bytes
コンパイル時間 3,809 ms
コンパイル使用メモリ 168,752 KB
実行使用メモリ 40,456 KB
最終ジャッジ日時 2023-08-25 02:08:32
合計ジャッジ時間 7,320 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
21,100 KB
testcase_01 AC 91 ms
23,140 KB
testcase_02 AC 91 ms
25,244 KB
testcase_03 AC 93 ms
23,224 KB
testcase_04 AC 91 ms
25,192 KB
testcase_05 AC 92 ms
25,232 KB
testcase_06 AC 92 ms
23,128 KB
testcase_07 AC 92 ms
25,232 KB
testcase_08 AC 91 ms
25,236 KB
testcase_09 AC 91 ms
23,340 KB
testcase_10 AC 208 ms
35,688 KB
testcase_11 AC 181 ms
37,496 KB
testcase_12 AC 227 ms
37,492 KB
testcase_13 AC 146 ms
34,808 KB
testcase_14 AC 281 ms
40,456 KB
testcase_15 AC 146 ms
31,808 KB
testcase_16 AC 196 ms
34,300 KB
testcase_17 AC 141 ms
32,760 KB
testcase_18 AC 166 ms
29,088 KB
testcase_19 AC 185 ms
35,768 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(17,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

// x <= arr[i]
let lowerBound x (arr: 'a []) =
    // arr[lf] < x <= arr[rg]
    let rec solve lf rg =
        if rg - lf <= 1 then
            rg
        else
            let mid = (rg + lf) / 2
            if arr.[mid] < x then solve mid rg else solve lf mid
    solve -1 arr.Length


[<EntryPoint>]
let main _ =
    let [| n; m; k |] = stdin.ReadLine().Split(' ') |> Array.map int64
    let line = stdin.ReadLine().Split(' ')
    let op = Array.head line |> Seq.head

    let b =
        Array.tail line
        |> Array.map int64
        |> Array.sort

    let a =
        [| for _ in 1L .. n -> stdin.ReadLine() |> int64 |]

    a
    |> Array.sumBy (fun x ->
        let y =
            if op = '+' then k - x else (k + x - 1L) /x

        let i =
            b
            |> lowerBound y
            |> int64

        m - i)
    |> printfn "%d"

    0
0