def main(): isOpen = stdarray.readBool2D() stdarray.write2D(flow(isOpen)) stdio.writeln(percolates(isOpen))
def main(): isAlive = stdarray.readBool2D() stdarray.write2D(living(isAlive)) stdio.writeln(percolates(isAlive))
def main(): import stdio stdio.writeln('A') stdio.writeln('--------------------') a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] stdarray.write2D(a) stdio.writeln() stdio.writeln('B') stdio.writeln('--------------------') b = identity(5) stdarray.write2D(b) stdio.writeln() stdio.writeln('C') stdio.writeln('--------------------') c = rand(5, 5) stdarray.write2D(c) stdio.writeln() stdio.writeln('A^T') stdio.writeln('--------------------') at = transpose(a); stdarray.write2D(b) stdio.writeln() stdio.writeln('A + A^T') stdio.writeln('--------------------') d = add(a, at) stdarray.write2D(d) stdio.writeln() stdio.writeln('A * A^T') stdio.writeln('--------------------') e = multiplyMM(a, at) stdarray.write2D(e) stdio.writeln()
def main(): open = stdarray.readBoolean2D() stdarray.write2D(flow(open)) stdio.writeln(percolates(open))