[Contian Virus] Do I misunstand something?
For input \n[[0,1,0,1,1,1,1,1,1,0],\n[0,0,0,1,0,0,0,0,0,0],\n[0,0,1,1,1,0,0,0,1,0],\n[0,0,0,1,1,0,0,1,1,0],\n[0,1,0,0,1,0,1,1,0,1],\n[0,0,0,1,0,1,0,1,1,1],\n[0,
For input \n[[0,1,0,1,1,1,1,1,1,0],\n[0,0,0,1,0,0,0,0,0,0],\n[0,0,1,1,1,0,0,0,1,0],\n[0,0,0,1,1,0,0,1,1,0],\n[0,1,0,0,1,0,1,1,0,1],\n[0,0,0,1,0,1,0,1,1,1],\n[0,1,0,0,1,0,0,1,1,0],\n[0,1,0,1,0,0,0,1,1,0],\n[0,1,1,0,0,1,1,0,0,1],\n[1,0,1,1,0,1,0,1,0,1]]\nMy solution gives answer=40 but the answer=38. \nI calculated manually, first all we should contain the infected area in the right(I change it to 2), and we need 22 walls;\n\t\t{ 0, 1, 0, 1, 1, 1, 1, 1, 1, 0 },\n\t\t{ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },\n\t\t{ 0, 0, 1, 1, 1, 0, 0, 0, 2, 0 }, // 3 walls\n\t\t{ 0, 0, 0, 1, 1, 0, 0, 2, 2, 0 }, // 2 walls, 2 walls\n\t\t{ 0, 1, 0, 0, 1, 0, 2, 2, 0, 2 }, // 3 walls, 1 walls, 2 walls\n\t\t{ 0, 0, 0, 1, 0, 1, 0, 2, 2, 2 }, // 1 walls, 1 walls, 1 walls\n\t\t{ 0, 1, 0, 0, 1, 0, 0, 2, 2, 0 }, // 1 walls, 1 walls\n\t\t{ 0, 1, 0, 1, 0, 0, 0, 2, 2, 0 }, // 2 walls, 2 walls\n\t\t{ 0, 1, 1, 0, 0, 1, 1, 0, 0, 1 },\n\t\t{ 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 };\nafter one day, it will be like this (* is newly affected cells)\n\t\t{ *, 1, *, 1, 1, 1, 1, 1, 1, * },\n\t\t{ 0, *, *, 1, *,  *,  *, *,  *, 0 },  \n\t\t{ 0, *, 1, 1, 1, *, 0, 0, 2, 0 },  \n\t\t{ 0, *, *, 1, 1, *, 0, 2, 2, 0 },\n\t\t{ *, 1, *, *, 1, *, 2, 2, 0, 2 },\n\t\t{ 0, *, *, 1, *, 1, *, 2, 2, 2 },\n\t\t{ *, 1, *, *, 1, *,  0, 2, 2, 0 },\n\t\t{ *, 1, *, 1, *, *,  *,  2, 2, * },\n\t\t{ *, 1, 1, *, *, 1, 1,  *,  *, 1 },\n\t\t{ 1, *, 1, 1, *, 1, *, 1,  *, 1 };\nand we need 18 walls to protect unaffected cells. Could any one tell me what is wrong with my answer? Do I misunderstand something?\n\nAny comments are welcome!
[]