結果

問題 No.216 FAC
ユーザー ichibanshiboriichibanshibori
提出日時 2017-05-07 21:16:33
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 672 bytes
コンパイル時間 4,803 ms
コンパイル使用メモリ 156,132 KB
実行使用メモリ 25,672 KB
最終ジャッジ日時 2023-10-12 16:13:11
合計ジャッジ時間 8,799 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
25,332 KB
testcase_01 AC 98 ms
23,324 KB
testcase_02 AC 99 ms
23,208 KB
testcase_03 AC 100 ms
23,252 KB
testcase_04 AC 99 ms
23,292 KB
testcase_05 AC 99 ms
25,368 KB
testcase_06 AC 98 ms
25,408 KB
testcase_07 RE -
testcase_08 AC 99 ms
23,360 KB
testcase_09 AC 98 ms
21,300 KB
testcase_10 AC 103 ms
23,408 KB
testcase_11 AC 98 ms
23,196 KB
testcase_12 AC 98 ms
25,396 KB
testcase_13 AC 98 ms
25,404 KB
testcase_14 AC 97 ms
23,332 KB
testcase_15 AC 101 ms
23,304 KB
testcase_16 AC 100 ms
23,456 KB
testcase_17 AC 99 ms
25,308 KB
testcase_18 AC 99 ms
23,348 KB
testcase_19 AC 99 ms
23,412 KB
testcase_20 AC 99 ms
23,392 KB
testcase_21 AC 100 ms
25,448 KB
testcase_22 AC 100 ms
23,264 KB
testcase_23 AC 99 ms
25,384 KB
testcase_24 AC 101 ms
25,444 KB
testcase_25 AC 98 ms
23,204 KB
testcase_26 AC 97 ms
23,344 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
        |> 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
        |> 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