← RoseCode

ROSECODE 130

Perfectly protected pillars

Philippe_57721 · Programming ·

In the main hall of the King's palace there are pillars disposed in a rectangular grid N*M

The king wants to dispose 4 guards at the 4 directions of each pillar.
A guard at the east of a pillar is at the west of the next pillar, etc ...

Being mathematically inclined, the king wants that for each pillar, there are exactly 2 guards looking at it and 2 guards turning their back.

Here is an example with 2*3 pillars (and 17 guards):
OOO
OOO


How many possible configurations are there for 4*6 pillars?

You are given: 374 configurations for 2*3 pillars
[My timing: 25 sec]