結果

問題 No.182 新規性の虜
ユーザー ichibanshiboriichibanshibori
提出日時 2016-10-21 00:16:09
言語 OCaml
(5.1.0)
結果
AC  
実行時間 169 ms / 5,000 ms
コード長 584 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 20,148 KB
実行使用メモリ 22,652 KB
最終ジャッジ日時 2024-04-17 08:34:44
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 93 ms
15,152 KB
testcase_09 AC 169 ms
22,652 KB
testcase_10 AC 137 ms
19,460 KB
testcase_11 AC 112 ms
17,548 KB
testcase_12 AC 41 ms
10,252 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 111 ms
12,716 KB
testcase_19 AC 78 ms
10,796 KB
testcase_20 AC 47 ms
8,576 KB
testcase_21 AC 131 ms
13,760 KB
testcase_22 AC 60 ms
9,536 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 129 ms
14,452 KB
testcase_25 AC 31 ms
11,520 KB
testcase_26 AC 17 ms
7,168 KB
testcase_27 AC 2 ms
5,376 KB
evil01.txt AC 130 ms
17,296 KB
evil02.txt AC 127 ms
17,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

module StrMap = Map.Make(String)

let solve alst =
  let rec solve' lst map =
    match lst with
    | [] -> map
    | x::xs ->
      let nextMap =
        if StrMap.mem x map then
          let cnt = StrMap.find x map in
          StrMap.add x (cnt + 1) map
        else
          StrMap.add x 1 map
      in
      solve' xs nextMap
  in
  solve' alst StrMap.empty |>
  StrMap.filter (fun k v -> v = 1) |>
  StrMap.cardinal

let () =
  let _ = read_line ()
  and alst = read_line () |>
             Str.split (Str.regexp_string " ")
  in
  solve alst |> print_int;
  print_newline ()
0