Submission #395820


Source Code Expand

let ans n m =
  let rel = Array.make_matrix n n false in
  let eval group =
    let check x =
      List.for_all (fun y -> x=y||rel.(x).(y)) group in
    if List.for_all check group then List.length group else 0
  in
  let result = ref 0 in
    for i = 1 to m do
      Scanf.scanf "%d %d\n" (fun x y ->
        Array.set rel.(x-1) (y-1) true;
        Array.set rel.(y-1) (x-1) true;
      )
    done;
    for i = 1 to ((1 lsl n)-1) do
      let rec make_group j =
        if j=n then [] else if (i land (1 lsl j))>0 then j::(make_group (j+1)) else make_group (j+1) in
        result := max !result (eval (make_group 0))
    done;
    Printf.printf "%d\n" !result in

  Scanf.scanf "%d %d\n" ans;;

Submission Info

Submission Time
Task D - 派閥
User garasubo
Language C++ (G++ 4.6.4)
Score 0
Code Size 721 Byte
Status CE

Compile Error

./Main.cpp:1:1: error: ‘let’ does not name a type
./Main.cpp:12:9: error: ‘Array’ does not name a type
./Main.cpp:13:7: error: expected unqualified-id before ‘)’ token
./Main.cpp:15:5: error: expected unqualified-id before ‘for’
./Main.cpp:20:5: error: ‘Printf’ does not name a type