It took a long time to get to a problem in this group I couldn't brute force, at least after focusing that force, but this one did it. I came up with a strategy which is similar to the one called "chasing the lights" in that it solves one light at a time, but it works in one pass with an endgame cleanup. It does require more data than a person can easily track, but quite easy for a computer. And I came up with it myself in about a day that I was also working. To solve Cody problems, I have done research on the internet, and even once bought a textbook (that didn't help) , but not this time.
I had to submit this three times. My full test came back under 48 seconds consistently. And the failed submissions aren't even on the solution board! ??
A very inspirational problem!!
When I saw this one, I started looking at the "holes" as much as the points retained in the cloud. I re-worked lattice 2, and worked all from 4 to 8 before posting any.
I certainly plan to review at least Tomoaki Takagi's and Rahul's solutions for lessons before going to other problems.
Essentially the same answer as Tomoaki Takagi. I squeezed a lot of Cody points out, and we handled the h=1 case differently. But otherwise the same solution, three applications of omoaki Takagi's lattice1() solution.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.