Solve a Picross Row

Python 2, 127 124 123 bytes

-1 byte thanks to @ovs !

l,a,b,c=input()
x=y=i=a|b|c
while i:
 if[len(z)for z in bin(i)[2:].split("0")if z]==l>i&a<1>~i&b:x&=~i;y&=i
 i-=1
print x,y

Try it online! or Verify test cases

(Timed-out in TIO for the 2nd test case, but I have verified the program on my PC.)

Reads from STDIN the list of streaks l, and 3 numbers a, b, c representing bit-masks of empty cells, filled cells, and unknown cells.
Prints to STDOUT 2 numbers, representing the bit-masks of guaranteed empty cells and guaranteed filled cells.

Tags:

Code Golf

Game