Cody

# Problem 1180. Knights and Knaves (part 2)

Solution 1938686

Submitted on 16 Sep 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
A=[true true false false true false true]; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); clear g A; assert(isequal(solver(f),false))

1 1 0 1 1 1 1 0 0 1 1 0 run = 1

Assertion failed.

2   Pass
A=[false true false true false]; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); clear g A; assert(isequal(solver(f),true))

1 0 0 1 1 0 0 1 run = 1

3   Fail
A=[false false true true true]; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); clear g A; assert(isequal(solver(f),false))

1 1 1 0 1 1 1 1 run = 1

Assertion failed.

4   Fail
A=[true false false true false false true true true]; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); clear g A; assert(isequal(solver(f),false))

0 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 run = 1

Assertion failed.

5   Pass
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 run = 1

6   Fail
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 1 1 0 1 run = 1

Assertion failed.

7   Pass
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 run = 1

8   Fail
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

1 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 run = 1

Assertion failed.