結果

問題 No.3707 Unique Ticket
コンテスト
ユーザー ta-eo
提出日時 2026-11-30 23:53:18
言語 OCaml
(5.5.2)
コンパイル:
ocamlfind ocamlopt -linkpkg -package zarith,str _filename_ -o a.out
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
+ 545µs
コード長 559 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,064 ms
コンパイル使用メモリ 22,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-11-30 23:53:25
合計ジャッジ時間 3,916 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45
権限があれば一括ダウンロードができます
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf

ソースコード

diff #
raw source code

open Scanf
open Printf

let solve n m ss =
  let tbl = 
    Array.init m (fun j ->
      Seq.fold_left (fun acc i -> acc + if ss.(i).[j] = 'o' then 1 else 0) 0 @@ Seq.init n Fun.id) 
  in
  Array.fold_left (fun acc s ->
    if
      not @@ String.for_all ((<>) 'o') s && 
      fst @@ 
        String.fold_left (fun (acc, i) c -> (acc && (c = 'x' || tbl.(i) = 1), i + 1)) 
          (true, 0) s
    then acc + 1
    else acc)
    0
    ss

let () =
  scanf " %d %d" @@ fun n m ->
  Array.init n (fun _ -> scanf " %s" Fun.id)
  |> solve n m 
  |> printf "%d\n"
0