Su tarea es modelar los efectos de la masa en los trozos de comida. Por favor agregue tres capas de corteza.
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0], // in
[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0],
[0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
|
V
[[0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,1,2],
[0,0,2,1,2,2,0,0,0,0,0,0,0,2,2,0,2,0],
[0,0,2,1,1,1,2,0,0,0,0,0,2,1,1,2,0,0],
[0,0,0,2,1,2,0,0,0,0,0,2,1,1,2,1,2,0],
[0,0,0,0,2,0,0,0,0,0,0,0,2,1,1,1,2,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0]]
|
V
[[0,0,3,2,3,3,0,0,0,0,0,0,0,3,3,2,1,2],
[0,3,2,1,2,2,3,0,0,0,0,0,3,2,2,3,2,3],
[0,3,2,1,1,1,2,3,0,0,0,3,2,1,1,2,3,0],
[0,0,3,2,1,2,3,0,0,0,3,2,1,1,2,1,2,3],
[0,0,0,3,2,3,0,0,0,0,0,3,2,1,1,1,2,3],
[0,0,0,0,3,0,0,0,0,0,0,0,3,2,2,2,3,0]]
|
V
[[0,4,3,2,3,3,4,0,0,0,0,0,4,3,3,2,1,2], // out
[4,3,2,1,2,2,3,4,0,0,0,4,3,2,2,3,2,3],
[4,3,2,1,1,1,2,3,4,0,4,3,2,1,1,2,3,4],
[0,4,3,2,1,2,3,4,0,4,3,2,1,1,2,1,2,3],
[0,0,4,3,2,3,4,0,0,0,4,3,2,1,1,1,2,3],
[0,0,0,4,3,4,0,0,0,0,0,4,3,2,2,2,3,4]]
Un poco de ayuda visual:
body {
background-color:#222;
color:lightgray;
}
<pre>
[[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>], // in
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>]]
|
V
[[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>]]
|
V
[[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>],
[<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:gold">0</span>]]
|
V
[[<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>], // out
[<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>],
[<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>]]
</pre>
La entrada es una matriz booleana que representa la freidora: 0 para el aceite, 1 para la comida. Su función o programa debe agregar las tres capas como 2s, 3s y 4s alrededor de los 1s, sobrescribiendo así algunos de los 0s. La masa se pega horizontal y verticalmente (pero no diagonalmente) a los alimentos de cualquier forma o tamaño, incluidas las rosquillas (alimentos con agujeros) y se desmorona ("píxeles" aislados de alimentos), y está restringida a los límites de la freidora. Las capas anteriores de masa se convierten en costra y no se ven afectadas por las posteriores.
En otras palabras, primero debe reemplazar todos los 0 que están en los vecindarios von-Neumann de 1s con 2s, luego reemplazar todos los 0s en los vecindarios von-Neumann de 2s con 3s, y finalmente reemplazar todos los 0s en los vecindarios von-Neumann de 3s con 4s. Por lo tanto, los números 2,3,4 representan una cantidad uno mayor que la distancia de Manhattan a la celda 1 más cercana.
La freidora tendrá un tamaño de al menos 3 por 3 y contendrá al menos una pieza de comida. I / O es flexible: utilice un formato de matriz adecuado para su idioma. Se permite espacio en blanco adicional, se desea un código más corto, se prohiben las lagunas.
Más pruebas:
[[0,0,1], // in
[0,0,0],
[0,1,0]]
[[3,2,1], // out
[3,2,2],
[2,1,2]]
-
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], // in
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0],
[1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0],
[0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0],
[0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],
[0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
[0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0]]
[[3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,3,3,4,3,3,3,4,4,4,3,2,1], // out
[2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,4,3,2,2,3,2,2,2,3,3,4,4,3,2],
[1,2,3,4,0,0,0,0,0,0,0,0,0,0,4,3,2,1,1,2,1,1,1,2,2,3,4,4,3],
[1,1,2,3,4,4,4,4,0,0,0,0,0,4,3,2,1,1,1,1,1,1,1,1,1,2,3,4,4],
[2,2,3,4,4,3,3,3,4,0,0,0,4,3,2,1,1,2,1,1,1,1,1,2,2,1,2,3,4],
[3,3,4,4,3,2,2,2,3,4,0,0,4,3,2,1,2,2,1,1,2,2,1,2,3,2,3,4,4],
[4,4,4,3,2,1,1,1,2,3,4,0,4,3,2,1,1,2,1,2,3,3,2,2,2,3,4,3,3],
[0,4,3,2,1,1,2,1,2,3,4,0,0,4,3,2,2,2,1,2,3,3,2,1,1,2,3,2,2],
[4,3,2,1,1,2,2,1,2,3,4,0,0,0,4,3,3,3,2,3,4,4,3,2,2,3,2,1,1],
[3,2,1,2,1,1,1,1,2,3,4,0,0,0,0,4,4,3,3,3,4,3,3,3,3,3,2,1,2],
[4,3,2,1,2,2,1,2,3,4,0,0,0,0,0,4,3,2,2,2,3,2,2,3,4,4,3,2,3],
[0,4,3,2,1,1,2,3,2,3,4,0,0,0,4,3,2,1,1,1,2,1,1,2,3,4,4,3,4],
[0,0,4,3,2,2,3,2,1,2,3,4,0,0,0,4,3,2,2,2,3,2,2,3,4,4,3,2,3],
[0,0,0,4,3,3,4,3,2,3,4,0,0,0,0,0,4,3,3,3,4,3,3,4,4,3,2,1,2],
Un poco de ayuda visual:
body {
background-color: #222;
color:lightgray;
}
<pre>[[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>], // in
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>]]
[[<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>], // out
[<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>],
[<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>]]
-
[[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>], // in
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:red">1</span>,<span style="color:gold">0</span>]]
[[<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>], // out
[<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>],
[<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>],
[<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>],
[<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>],
[<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>],
[<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>],
[<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>],
[<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>],
[<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>],
[<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:gold">0</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:chocolate">3</span>,<span style="color:orange">4</span>,<span style="color:orange">4</span>,<span style="color:chocolate">3</span>,<span style="color:brown">2</span>,<span style="color:red">1</span>,<span style="color:brown">2</span>],
</pre>
Gracias @Tschallacka por las visualizaciones.
000010000
→000212000
→003212300
→043212340
Respuestas:
Plantilla : 1 + 14 = 15 bytes
Argumento de línea de comando:
3
Código:
s<×⌈/N:1+⌈/N⋄S
Pruébalo en línea!
3
repita la siguiente transformación tres veces:s
si el s elfo no está vacío<
es menos que×
el signo de⌈/N
el máximo del barrio von neuman N:
entonces el nuevo valor se convierte1+
uno más⌈/N
el máximo del barrio von neuman N⋄
másS
el valor permanece sin modificar ( S elf)fuente
3
)? La primera vez que veo Stencil , pero si entiendo correctamente, ¿es una extensión para Dyalog APL para beneficiar a las matrices? Además, una pequeña observación: la N mayúscula al comienzo deNeumann
debe estar en negrita en lugar de la pequeña al final en su explicación. :)⌺
incorporado (llamado Stencil ). Ver también su documentación . ¡Todo un lenguaje de golf construido sobre una sola incorporación! En realidad, he creado otros dos idiomas de golf basándome en los módulos integrados Dyalog APL: QuadR y QuadS .Java 8,
271269247210202198193 bytesJava y matrices dependientes del índice. No es una buena combinación para un lenguaje ya detallado, para empezar.
Modifica la matriz de entrada en lugar de devolver una nueva.
Explicación:
Pruébalo en línea.
fuente
Stencil + CLA:
3
11 bytesPruébalo en línea!
-1 gracias a Adám .
-2 gracias a una sugerencia en otra respuesta por NGN , que me llevó a convertir esto desde la plantilla de la plantilla + CLA:
3
.fuente
JavaScript (ES6),
107105bytesCasos de prueba
Mostrar fragmento de código
Comentado
fuente
Python 3 , 176 bytes
Pruébalo en línea!
-18 bytes gracias a Mr. Xcoder
-20 bytes gracias a ovs
fuente
Python 2 ,
146143 bytesPruébalo en línea!
fuente
Fortran 95,
309299294287269 bytesFortran no es un lenguaje de golf.
any()
if
s
fuente
Wolfram Language (Mathematica) , 70 bytes
Pruébalo en línea!
fuente
Limpio , 157 bytes
Pruébalo en línea!
Como una función literal.
fuente
Perl, 63 bytes
Incluye +3 para
0ap
Proporcione la matriz de entrada como un bloque de dígitos sin nueva línea final., P. Ej.
para el ejemplo 3x3. El formato de salida es el mismo, un bloque de dígitos sin nueva línea final.
Puedes usar un pequeño script como
para eliminar convenientemente las nuevas líneas finales de un archivo si eso es difícil de hacer en su editor favorito
fuente
APL (Dyalog Unicode) ,
343023 bytes ( abrudz / SBCS )Pruébalo en línea!
-4 gracias a ngn .
fuente
Retina ,
938784 bytesPruébalo en línea! Basado en mi respuesta a Kill it With Fire . Editar: Guardado
69 bytes gracias a @MartinEnder. Explicación:Convierte todos los 1s en 4s.
Repita el resto del programa (como máximo) 3 veces.
Cambia todos los 0 adyacentes a 4 en 5.
Disminuya todos los dígitos.
Retina 0.8.2 ,
10094 bytesPruébalo en línea! Explicación:
Convierte todos los 1s en 3s.
Repita hasta que la salida no cambie.
Cambia todos los 0 adyacentes a 3 en 4.
Si no hay 1, disminuya todos los dígitos.
fuente
!
(que no puede aparecer en la entrada) en lugar de(?!)
.Rubí ,
183158146 bytesPruébalo en línea!
Utiliza el algoritmo obvio de tres bucles.
El hecho de que Ruby permita la indexación negativa en matrices significa que no hay forma (que pueda ver) de hacer las verificaciones de límites.Alcanzar más allá del límite de una matriz devuelvenil
, por lo que solo son necesarias las comprobaciones negativas. La verificacióna[i+1][j]
solo necesita usar el operador de acceso seguro.También reduje algunos bytes usando una variable para
a[0]
.-12 bytes más: uso en
.times
lugar de(0...x).map
(en tres lugares).fuente