Grill Below the Meats
Time limit1sMemory limit512 MB
Tile a 40 by 40 grid with three identical unrotated pieces so that flipping any single piece leaves no valid position, and print one such layout.
- Level
Medium6 of 10
- Topics
- Implementation, Brute force
- Solved
- No attempts yet
Problem
Last night Dongmin, Bin, and Sanha held a barbecue party and grilled meat on the grill. Since it was an outdoor party, they grilled the meat on the grill. The grill is a grid.

Dongmin, the eldest of the three, bought three pieces of meat of exactly the same shape from a butcher. He placed the pieces on the grid without rotating or flipping them, and without overlapping. Dongmin wanted no part of the meat to go unbroiled under the grill wires, so he placed the pieces to fit the grid exactly. The figure above shows the pieces placed according to Dongmin's conditions. (In the figure, the piece opposite the 'ㅇ' is 'ㅅ'.)
When it was time to flip the meat, Dongmin tried to flip one piece, either up and down or left and right. He picked up one of his own pieces and flipped it, but there was no place to put it without overlapping. He tried with one of Bin's or Sanha's pieces too, and again there was no place to put it. In the end, Dongmin picked up all three pieces at once and flipped them.
The next day Dongmin does not remember the shape of the meat from yesterday. He vaguely remembers that something unusual happened when the meat was flipped, so he tries to work out how the meat was arranged yesterday. Find an arrangement of the meat such that there is no way to flip exactly one piece.
Input
There is no input.
Output
Print the grill with the meat placed on it over 40 lines. . marks a spot without meat, 1 marks Dongmin's meat, 2 marks Bin's meat, and 3 marks Sanha's meat. If several answers exist, print any of them.