結果

問題 No.406 鴨等間隔の法則
ユーザー maimai8maimai8
提出日時 2020-07-24 13:43:48
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 21,448 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 09:06:57
合計ジャッジ時間 2,653 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
6,016 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 50 ms
6,528 KB
testcase_05 AC 20 ms
6,016 KB
testcase_06 AC 21 ms
6,016 KB
testcase_07 AC 21 ms
6,016 KB
testcase_08 AC 48 ms
6,656 KB
testcase_09 AC 56 ms
6,656 KB
testcase_10 AC 22 ms
6,016 KB
testcase_11 AC 40 ms
6,528 KB
testcase_12 AC 27 ms
6,272 KB
testcase_13 AC 24 ms
6,144 KB
testcase_14 AC 43 ms
6,400 KB
testcase_15 WA -
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 4 ms
5,376 KB
testcase_18 AC 5 ms
5,376 KB
testcase_19 AC 7 ms
5,376 KB
testcase_20 AC 8 ms
5,504 KB
testcase_21 AC 8 ms
5,632 KB
testcase_22 AC 13 ms
5,760 KB
testcase_23 AC 28 ms
6,144 KB
testcase_24 AC 38 ms
6,400 KB
testcase_25 AC 54 ms
6,656 KB
testcase_26 AC 54 ms
6,784 KB
testcase_27 WA -
testcase_28 AC 40 ms
6,784 KB
testcase_29 AC 52 ms
6,784 KB
testcase_30 AC 54 ms
6,784 KB
testcase_31 AC 53 ms
6,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let xrr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let () = Array.fast_sort compare xrr in
  let diff = xrr.(1) - xrr.(0) in
  let ans = Array.fold_left 
      (fun (b, bfr) n -> if n - bfr = diff || n = bfr then (b && true, n) else (false, n)) 
      (true, xrr.(0)) xrr in
  Printf.printf "%s\n" (if fst ans then "YES" else "NO")
0