結果

問題 No.1456 Range Xor
ユーザー xsdxsd
提出日時 2022-07-28 01:38:20
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 960 ms
コンパイル使用メモリ 22,000 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-17 15:23:48
合計ジャッジ時間 4,453 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 19 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d %d" (fun n k ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let module S = Set.Make (struct type t = int let compare = compare end) in

    let rec loop i acc set =
        if i = n then false else
            let acc = acc lor a.(i) in
            if S.mem (acc lxor k) set then true else
                loop (i + 1) acc (S.add acc set)
    in
    print_endline @@ if loop 0 0 S.empty then "Yes" else "No"
)
0