Tugas Anda adalah membuat model efek adonan pada potongan makanan. Silakan tambahkan tiga lapisan kerak.
[[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]]
Sedikit bantuan 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>
Masukan adalah matriks boolean yang mewakili alat penggoreng: 0 untuk minyak, 1 untuk makanan. Fungsi atau program Anda harus menambahkan tiga layer sebagai 2s, 3s, dan 4s di sekitar 1s, sehingga menimpa beberapa dari 0s. Adonan menempel secara horizontal dan vertikal (tetapi tidak diagonal) untuk makanan dalam bentuk atau ukuran apa pun, termasuk donat (makanan berlubang) dan remuk (makanan terisolasi "piksel"), dan terbatas pada batas penggorengan. Lapisan adonan yang sebelumnya berubah menjadi kerak dan tidak terpengaruh oleh lapisan selanjutnya.
Dengan kata lain, pertama Anda harus mengganti semua 0s yang ada di lingkungan von-Neumann dari 1s dengan 2s, lalu ganti semua 0s di lingkungan von-Neumann dari 2s dengan 3s, dan akhirnya ganti semua 0s di lingkungan von-Neumann dari 3s dengan 4s. Dengan demikian, angka 2,3,4 mewakili kuantitas yang lebih besar dari jarak Manhattan ke 1-sel terdekat.
Alat penggoreng akan berukuran setidaknya 3-oleh-3 dan itu akan mengandung setidaknya satu potong makanan. I / O fleksibel - gunakan format matriks yang cocok untuk bahasa Anda. Ruang kosong ekstra diizinkan, kode pendek diinginkan, celah terlarang.
Tes lebih lanjut:
[[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],
Sedikit bantuan 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>
Terima kasih @Tschallacka untuk visualisasi.
000010000
→000212000
→003212300
→043212340
Jawaban:
Stensil : 1 + 14 = 15 byte
Argumen baris perintah:
3
Kode:
s<×⌈/N:1+⌈/N⋄S
Cobalah online!
3
ulangi transformasi tiga kali berikut:s
jika apakah s elf tidak kosong<
kurang dari×
signum dari⌈/N
maksimum dari von neuman N lingkungan:
maka nilai baru menjadi1+
satu ditambah⌈/N
maksimum dari von neuman N lingkungan⋄
lainS
nilai tetap tidak dimodifikasi ( S elf)sumber
3
)? Pertama kali melihat Stensil , tetapi jika saya mengerti benar itu adalah ekstensi untuk Dyalog APL untuk mendapatkan manfaat matriks? Juga, komentar kecil: Modal N pada awalNeumann
harus tebal, bukan modal kecil di akhir penjelasan Anda. :)⌺
built-in APL (disebut Stencil ). Lihat juga dokumentasinya . Seluruh bahasa bermain golf dibangun di atas satu built-in! Sebenarnya, saya telah membuat dua bahasa golf lainnya berdasarkan pada Dyalog APL built-in: QuadR dan QuadS .Java 8,
271269247210202198193 byteMatriks Java dan index-dependent .. Bukan kombinasi yang baik untuk bahasa yang sudah verbose untuk memulai ..
Memodifikasi input-matriks alih-alih mengembalikan yang baru.
Penjelasan:
Cobalah online.
sumber
Stensil + CLA:,
3
11 byteCobalah online!
-1 terima kasih kepada Adám .
-2 berkat saran pada jawaban lain dengan ngn , yang menyebabkan saya untuk mengkonversi ini dari Stencil ke Stencil + CLA:
3
.sumber
JavaScript (ES6),
107105 byteUji kasus
Tampilkan cuplikan kode
Berkomentar
sumber
Python 3 , 176 byte
Cobalah online!
-18 byte terima kasih kepada Tn. Xcoder
-20 byte terima kasih kepada ovs
sumber
Python 2 ,
146143 byteCobalah online!
sumber
Fortran 95,
309299294287269 byteFortran bukan bahasa golf.
any()
if
s
sumber
Bahasa Wolfram (Mathematica) , 70 byte
Cobalah online!
sumber
Bersih , 157 byte
Cobalah online!
Sebagai fungsi literal.
sumber
Perl, 63 byte
Termasuk +3 untuk
0ap
Berikan matriks input sebagai blok digit tanpa baris baru, misalnya
untuk contoh 3x3. Format outputnya sama, satu blok digit tanpa baris akhir final.
Anda dapat menggunakan skrip kecil seperti
untuk dengan mudah menghapus baris baru dari file jika itu sulit dilakukan di editor favorit Anda
sumber
APL (Dyalog Unicode) ,
343023 byte ( abrudz / SBCS )Cobalah online!
-4 Terima kasih kepada ngn .
sumber
Retina ,
938784 byteCobalah online! Berdasarkan jawaban saya untuk Kill it With Fire . Sunting: Disimpan
69 byte berkat @MartinEnder. Penjelasan:Ubah semua angka 1 menjadi angka 4.
Ulangi sisa program (paling banyak) 3 kali.
Ubah semua 0s yang berdekatan dengan 4s menjadi 5s.
Perkecil semua digit.
Retina 0.8.2 ,
10094 byteCobalah online! Penjelasan:
Ubah semua angka 1 menjadi angka 3.
Ulangi sampai output tidak berubah.
Ubah semua 0s yang berdekatan dengan 3s menjadi 4s.
Jika tidak ada angka 1, kurangi semua digit.
sumber
!
(yang tidak dapat muncul di input) sebagai gantinya(?!)
.Ruby ,
183158146 byteCobalah online!
Menggunakan algoritma tiga putaran yang jelas.
Fakta bahwa Ruby memungkinkan pengindeksan negatif ke dalam array berarti bahwa tidak ada cara (yang bisa saya lihat) dalam membuat batas memeriksa.Mencapai di luar batas array akan kembalinil
, jadi hanya pemeriksaan batas negatif yang diperlukan. Cek untuka[i+1][j]
hanya perlu menggunakan operator akses yang aman.Saya juga mencukur beberapa byte dengan menggunakan variabel untuk
a[0]
.-12 byte lebih banyak: Gunakan
.times
alih-alih(0...x).map
(di tiga tempat).sumber