結果

問題 No.182 新規性の虜
ユーザー r6eve
提出日時 2017-08-11 09:39:34
言語 OCaml
(5.2.1)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-10-09 00:11:43
合計ジャッジ時間 2,087 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

let read () = Scanf.scanf "%d " (fun i -> i)

module H = Hashtbl

let () =
  let n = read () in
  let tbl = H.create ~random:true n in
  let rec doit i =
    if i = n then ()
    else begin
      let a = read () in
      if not (H.mem tbl a) then H.replace tbl a 1
      else H.replace tbl a (H.find tbl a + 1);
      doit (i + 1)
    end in
  doit 0;
  H.fold (fun _ n s -> s + if n = 1 then 1 else 0) tbl 0 |> Printf.printf "%d\n"
0