Cody

Solution 1938692

Submitted on 16 Sep 2019 by Augusto Mazzei
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   Pass
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))

liers = 1×7 logical array 0 0 1 1 0 1 0 run = logical 0

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))

liers = 1×5 logical array 1 0 1 0 1 run = logical 1

3   Pass
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))

liers = 1×5 logical array 1 1 0 0 0 run = logical 0

4   Pass
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))

liers = 1×9 logical array 0 1 1 0 1 1 0 0 0 run = logical 0

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))

liers = 1×99 logical array Columns 1 through 45 0 0 1 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1 0 1 0 Columns 46 through 90 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 1 0 0 1 1 0 1 1 1 1 Columns 91 through 99 0 1 0 1 0 0 0 0 0 run = logical 0

6   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))

liers = 1×99 logical array Columns 1 through 45 1 1 1 1 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1 1 1 Columns 46 through 90 1 0 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 0 0 1 0 1 1 Columns 91 through 99 0 1 1 1 0 0 1 1 1 run = logical 1

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))

liers = 1×99 logical array Columns 1 through 45 0 0 0 1 1 1 1 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 0 0 0 0 0 1 1 0 1 0 Columns 46 through 90 1 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 0 Columns 91 through 99 0 0 1 0 0 1 0 1 0 run = logical 0

8   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))

liers = 1×99 logical array Columns 1 through 45 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 0 0 1 1 1 1 0 0 1 0 1 0 0 0 Columns 46 through 90 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 1 1 Columns 91 through 99 1 0 1 1 0 0 1 1 1 run = logical 0

Suggested Problems

More from this Author38