結果

問題 No.406 鴨等間隔の法則
ユーザー Nobita GomuNobita Gomu
提出日時 2017-10-05 14:40:12
言語 F#
(F# 4.0)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 4,650 ms
コンパイル使用メモリ 154,652 KB
実行使用メモリ 50,204 KB
最終ジャッジ日時 2023-09-21 18:38:12
合計ジャッジ時間 10,394 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
29,312 KB
testcase_01 AC 104 ms
25,340 KB
testcase_02 AC 105 ms
27,276 KB
testcase_03 AC 93 ms
26,944 KB
testcase_04 AC 156 ms
33,532 KB
testcase_05 AC 121 ms
29,672 KB
testcase_06 AC 121 ms
27,692 KB
testcase_07 AC 122 ms
29,828 KB
testcase_08 AC 152 ms
37,444 KB
testcase_09 AC 158 ms
36,004 KB
testcase_10 AC 124 ms
31,184 KB
testcase_11 AC 147 ms
36,844 KB
testcase_12 AC 129 ms
31,584 KB
testcase_13 AC 130 ms
31,504 KB
testcase_14 AC 258 ms
43,924 KB
testcase_15 AC 101 ms
25,300 KB
testcase_16 AC 122 ms
26,424 KB
testcase_17 AC 120 ms
26,024 KB
testcase_18 AC 125 ms
28,584 KB
testcase_19 AC 126 ms
26,584 KB
testcase_20 AC 131 ms
28,604 KB
testcase_21 AC 133 ms
29,088 KB
testcase_22 AC 152 ms
36,028 KB
testcase_23 AC 135 ms
33,828 KB
testcase_24 AC 237 ms
42,248 KB
testcase_25 AC 160 ms
36,024 KB
testcase_26 AC 288 ms
48,140 KB
testcase_27 AC 147 ms
34,040 KB
testcase_28 AC 158 ms
35,988 KB
testcase_29 AC 284 ms
50,204 KB
testcase_30 AC 283 ms
47,892 KB
testcase_31 AC 155 ms
35,784 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let f (s:string) = s.Split ' ' |> Seq.map int
let uniqCount = Seq.distinct >> Seq.length

let isValid0 n s = n = (s |> f |> uniqCount)
let isValid1 s =
    let cache = s |> (f >> Seq.sort >> Seq.cache)
    1 = (Seq.zip cache (Seq.skip 1 cache)
         |> Seq.map (fun e -> (snd e) - (fst e))
         |> uniqCount)

let isValid n s = (isValid0 n s) && (isValid1 s)

if isValid (stdin.ReadLine () |> int) (stdin.ReadLine ()) then
    "YES"
else
    "NO"
|> printfn "%s"
0