結果

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

ソースコード

diff #
raw source code

open Scanf
open Printf

let solve aa =
  let t = Array.make 11 0 in
  let _ = Array.fold_left (fun _ a -> t.(a) <- t.(a) + 1) () aa in
  match
    Array.fold_left
      (fun (acc, i) cnt -> (if cnt < 1 || 2 < cnt then acc else (i, cnt) :: acc), i + 1) 
      ([], 0) t
    |> fst
  with
  | (i, 1) :: [] -> "1\n" ^ string_of_int i
  | (i, 2) :: (j, 2) :: [] -> sprintf "2\n%d %d" j i
  | _ -> "0\n"

let () =
  let a = Array.init 13 (fun _ -> scanf " %d" Fun.id) in
  let ans = solve a in
  printf "%s\n" ans
0