結果

問題 No.406 鴨等間隔の法則
ユーザー pekempeypekempey
提出日時 2017-01-27 18:38:19
言語 F#
(F# 4.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 3,983 ms
コンパイル使用メモリ 160,504 KB
実行使用メモリ 36,072 KB
最終ジャッジ日時 2023-09-21 18:22:14
合計ジャッジ時間 9,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
28,600 KB
testcase_01 AC 62 ms
20,340 KB
testcase_02 AC 62 ms
24,184 KB
testcase_03 AC 60 ms
20,204 KB
testcase_04 AC 140 ms
32,980 KB
testcase_05 AC 95 ms
23,932 KB
testcase_06 AC 97 ms
26,224 KB
testcase_07 AC 97 ms
26,212 KB
testcase_08 AC 142 ms
33,024 KB
testcase_09 AC 148 ms
33,724 KB
testcase_10 AC 100 ms
26,620 KB
testcase_11 AC 130 ms
32,116 KB
testcase_12 AC 108 ms
28,880 KB
testcase_13 AC 105 ms
27,120 KB
testcase_14 AC 134 ms
32,440 KB
testcase_15 AC 74 ms
25,016 KB
testcase_16 AC 75 ms
23,020 KB
testcase_17 AC 74 ms
24,628 KB
testcase_18 AC 75 ms
23,272 KB
testcase_19 AC 75 ms
23,428 KB
testcase_20 AC 78 ms
23,640 KB
testcase_21 AC 78 ms
21,660 KB
testcase_22 AC 86 ms
24,620 KB
testcase_23 AC 112 ms
29,936 KB
testcase_24 AC 128 ms
31,436 KB
testcase_25 AC 154 ms
36,072 KB
testcase_26 AC 149 ms
34,152 KB
testcase_27 AC 137 ms
33,956 KB
testcase_28 AC 144 ms
36,028 KB
testcase_29 AC 150 ms
36,072 KB
testcase_30 AC 147 ms
33,804 KB
testcase_31 AC 144 ms
33,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let solve x =
    let n = Array.length x
    let mutable mn = 1000000000
    let mutable mx = -1000000000
    for i in 0 .. n - 2 do
        mn <- min mn (x.[i + 1] - x.[i])
        mx <- max mx (x.[i + 1] - x.[i])
    if mn = mx && mx <> 0 then "YES" else "NO"
        

let n = System.Console.ReadLine() |> int
let x = System.Console.ReadLine().Split() |> Array.map int |> Array.sort

System.Console.WriteLine(solve x)


0