結果

問題 No.11 カードマッチ
ユーザー r6eve
提出日時 2017-08-22 10:09:12
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 22,004 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-09 00:28:24
合計ジャッジ時間 980 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

module S = Set.Make (struct
  type t = int
  let compare = (-)
end)

let () =
  let w, h, n = Scanf.scanf "%d %d %d " (fun w h n -> w, h, n) in
  let rec read i ss ks =
    if i = n then S.cardinal ss, S.cardinal ks
    else
      let s, k = Scanf.scanf "%d %d " (fun s k -> s, k) in
      let s, k = s - 1, k - 1 in
      read (i + 1) (S.add s ss) (S.add k ks) in
  let ns, nk = read 0 S.empty S.empty in
  ns * h + w * nk - ns * nk - n |> Printf.printf "%d\n"
0