Scala, 165 136 bytes
Port of @mousetail's Rust answer in Scala.
Golfed version. Try it online!
Saved 29 bytes thanks to the comment of @corvus_192
(a,b)=>(a zip b)./:(Seq((0,0))){case(c,(z,y))=>c.flatMap{case(f,v)=>Seq((f+z,v+y),(f+y,v+z))}filter(g=>g._1>=0&&g._2>=0)}exists((0,0)==)
Ungolfed version. Try it online!
object Main {
def main(args: Array[String]): Unit = {
val f: (Seq[Byte], Seq[Byte]) => Boolean = (a, b) => {
a.zip(b).foldLeft(Seq[(Int, Int)]((0,0))) { (c, de) =>
c.flatMap { f =>
Seq((f._1 + de._1, f._2 + de._2), (f._1 + de._2, f._2 + de._1))
}.filter(g => g._1 >= 0 && g._2 >= 0)
}.exists(_ == (0, 0))
}
val testCases = Seq(
(Seq(1.toByte), Seq((-1).toByte), false),
(Seq(1.toByte, (-1).toByte), Seq(1.toByte, (-1).toByte), true),
(Seq(1.toByte, 1.toByte, 1.toByte, (-1).toByte, (-1).toByte, (-1).toByte), Seq(1.toByte, (-1).toByte, 1.toByte, (-1).toByte, 1.toByte, (-1).toByte), true),
(Seq(1.toByte, (-1).toByte, 1.toByte, (-1).toByte, (-1).toByte, (-1).toByte), Seq(1.toByte, 1.toByte, 1.toByte, (-1).toByte, 1.toByte, (-1).toByte), true),
(Seq((-1).toByte, (-1).toByte, (-1).toByte, 1.toByte, 1.toByte, 1.toByte), Seq(1.toByte, 1.toByte, 1.toByte, (-1).toByte, (-1).toByte, (-1).toByte), false),
(Seq.fill(6)((-1).toByte), Seq.fill(6)((-1).toByte), false),
(Seq.fill(7)((-1).toByte), Seq.fill(7)((-1).toByte), false),
(Seq(1.toByte) ++ Seq.fill(6)((-1).toByte), Seq.fill(6)(1.toByte) ++ Seq((-1).toByte), false)
)
for (testCase <- testCases) {
println(s"${testCase._1} ${testCase._2} expected: ${testCase._3}, got: ${f(testCase._1, testCase._2)}")
}
}
}
1
and-1
\$\endgroup\$