You are given v boolean variables x0,x1,...,xv−1 that xi can be either 1 (true) or 0 (false).
Let us define an environment env, an assignment of either 0 or 1 to all v variables (like v=3, env={x0=0,x1=1,x2=0}).
Also, let us define an expression exp, a string that can be generated by the following grammar:⟨expression⟩::=x0 | x1 | ... |xv−1 | ⟨operation⟩⟨operation⟩::=(not ⟨expression⟩)| (⟨expression⟩ and ⟨expression⟩)| (⟨expression⟩ or ⟨expression⟩)| (⟨expression⟩ xor ⟨expression⟩)
For example, is an expression.
Each expression has a value in an environment. (for example, expression ((x0 xor x1) or x2) has value 0 in environment {x0=1,x1=1,x2=0} but it has value 1 in environment {x0=0,x1=0,x2=1} ).
You are given n environments env1,env2,...,envn and their expected value y1,y2,...,yn (the value that the expressions should have in them), find an expression that satisfies environments as much as possible, and uses operations (and, or, not, xor) as least as possible, in other words for each of 20 tests your score will be:
Input format
Output format
Print a single line of the expression.
Constraints
Notes
Also experssion x0 (should be printed 0) satisfies all enviroments.