in reply to Google Code Jam 2019 Round 1A Problem 1: Pylons
Crummy problem :( ----- (because random)
This is a permutation problem with a weak ordering requirement.
"shuffle" the grid indexes, about half the time always taking the first non-conflict from the array of empty indexes gives a valid order, if not, reshuffle till it works.
I am seeing on average slightly less than one reshuffle per grid solution over all the grids.
Processes all 361 grids in under 2 seconds total typically.
( slight cheat: All IMPOSSIBLEs are hard coded (HINT: there are very few) :)
It's not in final submit form because I wanted to test all grid sizes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Google Code Jam 2019 Round 1A Problem 1: Pylons
by LanX (Saint) on Apr 15, 2019 at 17:01 UTC | |
by tybalt89 (Monsignor) on Apr 15, 2019 at 17:43 UTC | |
by LanX (Saint) on Apr 15, 2019 at 19:24 UTC | |
by tybalt89 (Monsignor) on Apr 15, 2019 at 19:44 UTC | |
by LanX (Saint) on Apr 15, 2019 at 20:03 UTC | |
|