結果

問題 No.349 干支の置き物
ユーザー taktak
提出日時 2018-07-27 21:31:47
言語 F#
(F# 4.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 3,627 ms
コンパイル使用メモリ 158,492 KB
実行使用メモリ 25,068 KB
最終ジャッジ日時 2023-09-18 02:31:24
合計ジャッジ時間 8,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
24,984 KB
testcase_01 AC 91 ms
24,932 KB
testcase_02 AC 91 ms
22,896 KB
testcase_03 AC 88 ms
23,032 KB
testcase_04 AC 90 ms
23,052 KB
testcase_05 AC 90 ms
25,008 KB
testcase_06 AC 90 ms
22,784 KB
testcase_07 AC 90 ms
20,908 KB
testcase_08 AC 90 ms
23,044 KB
testcase_09 AC 88 ms
22,964 KB
testcase_10 AC 90 ms
20,912 KB
testcase_11 AC 89 ms
24,928 KB
testcase_12 AC 89 ms
24,964 KB
testcase_13 AC 89 ms
23,008 KB
testcase_14 AC 90 ms
25,068 KB
testcase_15 AC 89 ms
22,912 KB
testcase_16 AC 89 ms
24,936 KB
testcase_17 AC 88 ms
23,124 KB
testcase_18 AC 89 ms
20,912 KB
testcase_19 AC 91 ms
20,980 KB
testcase_20 AC 89 ms
25,060 KB
testcase_21 AC 88 ms
23,108 KB
testcase_22 AC 89 ms
25,008 KB
testcase_23 AC 88 ms
22,908 KB
testcase_24 AC 89 ms
25,064 KB
testcase_25 AC 90 ms
24,768 KB
testcase_26 AC 88 ms
23,128 KB
testcase_27 AC 88 ms
25,012 KB
testcase_28 AC 87 ms
22,936 KB
testcase_29 AC 89 ms
22,908 KB
testcase_30 AC 89 ms
22,740 KB
testcase_31 AC 89 ms
23,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let R() = stdin.ReadLine()
let N = R() |> int
let A = Array.init N (fun _ -> R())
         
let ans =
    let maxEtoNum =
        let EtoNums = 
            A 
            |> Array.countBy(fun x -> x)
            |> Array.map(fun (_, value) -> value)
        EtoNums |> Array.max
    let (|ODD|EVE|) n = match n % 2 with | 1 -> ODD | _ -> EVE
    let isEnable = 
        match N with
        | ODD -> maxEtoNum <= N / 2 + 1
        | EVE -> maxEtoNum <= N / 2
    isEnable |> function | true -> "YES" | _ -> "NO"
    
ans |> printfn "%s"        
0