結果

問題 No.1285 ゴミ捨て
コンテスト
ユーザー semisagi
提出日時 2020-11-13 21:27:42
言語 OCaml
(5.5.1)
コンパイル:
ocamlfind ocamlopt -linkpkg -package zarith,str _filename_ -o a.out
実行:
./a.out
結果
AC  
実行時間 41 ms / 2,000 ms
+ 817µs
コード長 288 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,733 ms
コンパイル使用メモリ 22,948 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-10-01 14:34:45
合計ジャッジ時間 3,934 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf

ソースコード

diff #
raw source code

let read_int () = Scanf.scanf " %d" (fun x -> x);;

let n = read_int ();;
let a = Array.init n (fun _ -> read_int ());;
Array.sort compare a;;

let all = ref true;;
for i = 0 to n - 2 do
  if a.(i) + 1 >= a.(i + 1) then
    all := false
done;;

print_endline (if !all then "1" else "2");;
0