Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Always find something positive solution in Clear category for Radiation Search by veky
def checkio(matrix):
container = {complex(i, j): number for i, row in enumerate(matrix)
for j, number in enumerate(row)}
def search(start):
if container[start] < 0: return -1, None
container[start] *= -1
size = 1
while ...:
unchanged = size
for spot, part in container.items():
for around in spot+1, spot-1, spot+1j, spot-1j:
if container.get(around) == -part > 0:
container[around], size = part, size+1
if size == unchanged: return size, -container[start]
return max(map(search, container))
Dec. 10, 2020
Comments: