結果
問題 |
No.11 カードマッチ
|
ユーザー |
![]() |
提出日時 | 2017-08-21 20:06:49 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 12 ms / 5,000 ms |
コード長 | 472 bytes |
コンパイル時間 | 418 ms |
コンパイル使用メモリ | 21,576 KB |
実行使用メモリ | 11,432 KB |
最終ジャッジ日時 | 2024-10-09 00:28:18 |
合計ジャッジ時間 | 1,177 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
let () = let w, h, n = Scanf.scanf "%d %d %d " (fun w h n -> w, h, n) in let a = Array.make w h in let rec read i ks = if i = n then List.length ks else begin let s, k = Scanf.scanf "%d %d " (fun s k -> s, k) in let s, k = s - 1, k - 1 in a.(s) <- a.(s) - 1; read (i + 1) (if List.mem k ks then ks else k :: ks) end in let z = read 0 [] in Array.fold_left (fun m e -> m + if e <> h then e else z) 0 a |> Printf.printf "%d\n"