結果
| 問題 | No.11 カードマッチ |
| コンテスト | |
| ユーザー |
r6eve
|
| 提出日時 | 2017-08-21 20:06:49 |
| 言語 | OCaml (5.4.1) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 290 ms |
| コンパイル使用メモリ | 22,800 KB |
| 実行使用メモリ | 11,648 KB |
| 最終ジャッジ日時 | 2026-04-25 04:33:38 |
| 合計ジャッジ時間 | 1,113 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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"
r6eve