BoardCoveringDiv1
TCO19 SRM 741 · 2018-10-30 · by Blue.Mary
Problem Statement
Lucyanna loves puzzles and she is always eager to invent new ones. She has recently invented a puzzle based on placing trominoes onto a square board.
The board is divided into a grid of unit squares. One of the unit squares on the board is black, all others are white.
A tromino is any connected piece that exactly covers three unit squares of the board. (Trominoes come in two shapes: "L" and "I".)
The goal of the puzzle is to cover all white squares of the board using trominoes. More precisely, the rules for Lucyanna's puzzle are as follows:
- The player must place some trominoes onto the board.
- Each tromino must exactly cover three unit squares of the board. (Thus, each tromino must lie completely inside the board.)
- Each white unit square must be covered by exactly one tromino. (Thus, the trominoes cannot overlap.)
- The black square must remain uncovered.
You are given the
If there are no solutions for the given N, R and C, return an empty
Constraints
- N will be between 1 and 47, inclusive.
- R will be between 0 and N-1, inclusive.
- C will be between 0 and N-1, inclusive.
1
0
0
Returns: {"#" }
2
1
1
Returns: {"00", "0#" }
3
0
2
Returns: { }
3
1
0
Returns: { }
3
1
1
Returns: { }
4
1
1
Returns: {"0011", "0#21", "3220", "3300" }
The example output represents the following 4x4 board with five trominoes: 0011 0#21 3220 3300
Submissions are judged against all 61 archived test cases, of which 6 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class BoardCoveringDiv1 with a public method vector<string> make(int N, int R, int C) · 61 test cases · 2 s / 256 MB per case