結果

問題 No.216 FAC
ユーザー ichibanshiboriichibanshibori
提出日時 2017-05-07 21:23:13
言語 F#
(F# 4.0)
結果
AC  
実行時間 99 ms / 1,000 ms
コード長 945 bytes
コンパイル時間 5,541 ms
コンパイル使用メモリ 153,656 KB
実行使用メモリ 25,464 KB
最終ジャッジ日時 2023-10-12 16:13:29
合計ジャッジ時間 7,408 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
23,204 KB
testcase_01 AC 97 ms
25,240 KB
testcase_02 AC 98 ms
23,324 KB
testcase_03 AC 98 ms
25,324 KB
testcase_04 AC 97 ms
23,484 KB
testcase_05 AC 97 ms
23,328 KB
testcase_06 AC 97 ms
23,352 KB
testcase_07 AC 87 ms
25,056 KB
testcase_08 AC 97 ms
23,356 KB
testcase_09 AC 97 ms
25,372 KB
testcase_10 AC 98 ms
23,276 KB
testcase_11 AC 96 ms
23,208 KB
testcase_12 AC 97 ms
25,452 KB
testcase_13 AC 97 ms
23,260 KB
testcase_14 AC 99 ms
23,268 KB
testcase_15 AC 97 ms
23,364 KB
testcase_16 AC 97 ms
23,344 KB
testcase_17 AC 98 ms
23,272 KB
testcase_18 AC 98 ms
23,336 KB
testcase_19 AC 97 ms
23,364 KB
testcase_20 AC 97 ms
25,460 KB
testcase_21 AC 97 ms
23,208 KB
testcase_22 AC 97 ms
23,284 KB
testcase_23 AC 97 ms
23,284 KB
testcase_24 AC 98 ms
25,412 KB
testcase_25 AC 98 ms
25,464 KB
testcase_26 AC 97 ms
23,456 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let solve a_seq b_seq =
    let ab_seq = Seq.zip a_seq b_seq
    let other_score =
        Seq.filter (fun (a, b) -> b <> 0) ab_seq
        |> fun sq ->
            if Seq.isEmpty sq then
                0
            else
                sq
                |> Seq.groupBy (fun (a, b) -> b)
                |> Seq.map (
                    fun (b, ab_seq) -> Seq.sumBy (fun (a, b) -> a) ab_seq)
                |> Seq.maxBy id
    let k_score =
        Seq.filter (fun (a, b) -> b = 0) ab_seq
        |> fun sq ->
            if Seq.isEmpty sq then
                0
            else
                sq
                |> Seq.sumBy (fun (a, b) -> a)
    if k_score >= other_score then
        "YES"
    else
        "NO"

let () =
    let _ = stdin.ReadLine()
    let a_lst = stdin.ReadLine().Split()
                |> Seq.map int
    let b_lst = stdin.ReadLine().Split()
                |> Seq.map int
    solve a_lst b_lst
    |> printfn "%s"
0