DominoesLines
TCCC06 Round 2A · 2006-08-22 · by Andrew_Lazarev
Problem Statement
Dominoes is a game played with rectangular tiles. Each tile (domino) is split in half vertically and contains two numbers between 0 and 6, inclusive. One tile A can be played after tile B if the left number of A is the same as the right number of B. Several consecutively played tiles are called a line. For example, the picture below shows a line containing four tiles.

You will be given a
Constraints
- tiles will contain between 1 and 50 elements, inclusive.
- Each element of tiles will be in the format "X:Y" where X and Y are digits between 0 and 6, inclusive.
{"1:0", "1:1", "1:2", "1:3", "1:4"}
Returns: {"0:1-1:1-1:2", "3:1-1:4" }
{"4:0", "4:1", "4:2", "4:3", "4:4"}
Returns: {"0:4-4:1", "2:4-4:4-4:3" }
{"0:0", "1:1", "2:2", "3:3", "6:6", "6:0"}
Returns: {"0:0-0:6-6:6", "1:1", "2:2", "3:3" }
{"0:4", "6:6", "1:2", "1:1", "3:1", "4:4", "0:1", "1:5", "5:0"}
Returns: {"0:1-1:1-1:2", "3:1-1:5-5:0-0:4-4:4", "6:6" }
{"5:0", "4:0", "4:0", "5:3", "3:0", "5:4", "5:3", "4:1", "5:5", "1:0",
"3:0", "0:2", "0:5", "6:3", "3:2", "1:1", "3:2", "4:1", "2:3", "4:2",
"4:1", "6:6", "6:6", "1:6", "5:4", "4:3", "6:6", "0:0", "5:2", "6:6"}
Returns: {"1:0-0:0-0:2-2:3", "4:0-0:3-3:0-0:4-4:1-1:1-1:4-4:1-1:6-6:6-6:6-6:6-6:6-6:3-3:2-2:3-3:4-4:2-2:5-5:0-0:5-5:3-3:5-5:4-4:5-5:5" }
Submissions are judged against all 85 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class DominoesLines with a public method vector<string> constructLines(vector<string> tiles) · 85 test cases · 2 s / 256 MB per case