{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003eh1,h2,h3,h4,h5,h6{margin-bottom:0;}div.textBG p{margin: 0 0 0.0001pt;}\u003c/style\u003e\u003cspan style\u003d\u0027float:right\u0027\u003e\u003ca target\u003d\u0027_blank\u0027 href\u003d\u0027http://uva.onlinejudge.org/external/114/11471.pdf\u0027\u003e\u003cimg width\u003d\u0027100\u0027 height\u003d\u002726\u0027 border\u003d\u00270\u0027 title\u003d\u0027Download as PDF\u0027 alt\u003d\u0027Download as PDF\u0027 src\u003d\u0027http://uva.onlinejudge.org/components/com_onlinejudge/images/button_pdf.png\u0027\u003e\u003c/a\u003e\u003c/span\u003e\u003cdiv style\u003d\u0027clear:both\u0027\u003e\u003c/div\u003e\u003chtml\u003e\u003chead\u003e\u003ctitle\u003eA :: Arrange the Tiles\u003c/title\u003e\u003cstyle type\u003d\"text/css\"\u003e\u003c!--\r\n.style1 {\r\n\tfont-family: Garamond;\r\n\tfont-weight: bold;\r\n\tfont-size: 28px;\r\n\tcolor: #FFFFFF;\r\n}\r\n.style3 {\r\n\tfont-family: \"Courier New\", Courier, monospace;\r\n\tfont-weight: bold;\r\n\tfont-size:15px\r\n}\r\n.style4 {\r\n\tfont-family: Georgia, \"Times New Roman\", Times, serif;\r\n\tfont-weight: bold;\r\n\tfont-size: 18px;\r\n\tcolor: #0000FF;\r\n}\r\n.style10 {font-family: \"Courier New\", Courier, monospace; font-weight: bold; font-size: 13px; }\r\n.style12 {font-family: Garamond; font-weight: bold; font-size: 16px; color: #FFFFFF; }\r\n.style11 {color: #0000FF}\r\n--\u003e\u003c/style\u003e\u003c/head\u003e\u003cbody\u003e\u003ctable width\u003d\"100%\" border\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd width\u003d\"3%\" height\u003d\"38\"\u003e\u0026nbsp;\u003c/td\u003e\u003ctd width\u003d\"32%\" bgcolor\u003d\"#0000FF\"\u003e\u003cdiv align\u003d\"center\" class\u003d\"style1\"\u003e Problem A \u003c/div\u003e\u003c/td\u003e\u003ctd bgcolor\u003d\"#0000FF\" width\u003d\"30%\"\u003e\u003cdiv align\u003d\"center\"\u003e\u003cspan class\u003d\"style1\"\u003e Arrange the Tiles\u003c/span\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd width\u003d\"21%\" align\u003d\"center\" valign\u003d\"middle\" bgcolor\u003d\"#0000FF\"\u003e\u003cdiv align\u003d\"center\"\u003e\u003cspan class\u003d\"style12\"\u003eTime Limit : 4 seconds\u003c/span\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd width\u003d\"12%\"\u003e\u003cdiv align\u003d\"center\"\u003e\u003c/div\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"3\"\u003e\u003cp\u003e\u0026nbsp;\u003c/p\u003e\u003cp\u003eThere is a board of dimension 4 x 3. Each cell of the board is a container that can hold a tile. The board is shown in the following diagram. \u003c/p\u003e\u003ctable width\u003d\"100%\" border\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd align\u003d\"center\"\u003e\u003cimg src\u003d\"http://uva.onlinejudge.org/external/114/p11471a.png\" align\u003d\"baseline\" /\u003e\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003cp align\u003d\"justify\"\u003eAs expected, you have got 12 tiles with you and you are required to place them in the containers so that every container has one tile in it. However, the tiles that you have are not ordinary tiles. Each tile is a square piece with all its 4 edges colored. A tile is described by its 4 edge colors starting from top and going clockwise. \u003c/p\u003e\u003ctable align\u003d\"center\" width\u003d\"228\" border\u003d\"1\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" width\u003d\"75\"\u003e\u003cimg src\u003d\"http://uva.onlinejudge.org/external/114/p11471b.png\" align\u003d\"middle\" /\u003e\u003c/td\u003e\u003ctd width\u003d\"75\" align\u003d\"center\"\u003e\u003cimg src\u003d\"http://uva.onlinejudge.org/external/114/p11471c.png\" align\u003d\"middle\" /\u003e\u003c/td\u003e\u003ctd width\u003d\"75\" align\u003d\"center\"\u003e\u003cimg src\u003d\"http://uva.onlinejudge.org/external/114/p11471d.png\" align\u003d\"middle\" /\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\"\u003eR G B Y \u003c/td\u003e\u003ctd align\u003d\"center\"\u003eR G R Y \u003c/td\u003e\u003ctd align\u003d\"center\"\u003eY Y Y Y \u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003cbr /\u003e The image shows 3 tiles. The description of the tiles are given below the image. The colors that will be used to denote the tiles will be from the set {yellow, green, blue and red} and will be represented by {Y, G, B and R} for the sake of brevity. \u003cp align\u003d\"justify\"\u003eThere are 12 factorials (12!) ways of placing the tiles on the board. A placement is considered fragile if the touching sides of any two adjacent tiles is made up of different colors. You are required to find out the total number of placements which are not fragile. \u003c/p\u003e\u003cp align\u003d\"justify\"\u003eNote: You can not rotate the tiles. That is, the initial orientation must be preserved. \u003c/p\u003e\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"2\"\u003e\u003cspan class\u003d\"style4\"\u003eInput\u003c/span\u003e\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"3\" align\u003d\"justify\"\u003eThe first line of input is an integer \u003cspan class\u003d\"style10\"\u003eT\u003c/span\u003e( \u003cspan class\u003d\"style10\"\u003eT\u003c/span\u003e \u0026lt; 20 ) that denotes the number of test cases. Each case starts on a new line and consists of one or more lines containing 12 strings. Each string represents a tile and is made up of 4 characters.\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"3\"\u003e\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"3\"\u003e\u003cspan class\u003d\"style4\"\u003eOutput\u003c/span\u003e\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"3\" align\u003d\"justify\"\u003eFor each case, output the case number followed by the total number of non-fragile placements. \u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd colspan\u003d\"3\"\u003e\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u003cspan class\u003d\"style4\"\u003eSample Input\u003c/span\u003e\u003c/td\u003e\u003ctd\u003e\u003cspan class\u003d\"style4\"\u003eSample Output \u003c/span\u003e\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd valign\u003d\"top\"\u003e\u003cp class\u003d\"style10\"\u003e2\u003cbr /\u003e BBBB BBBB BBBB BBBB BBBB BBBB BBBB BBBB BBBB BBBB BBBB YYYY\u003cbr /\u003e GGGG GGGG GGGG GGGG GGGG GGGG GGGG GGGG GGGG GGGG GGGG GGGG\u003cbr /\u003e\u003cbr /\u003e\u003c/p\u003e\u003c/td\u003e\u003ctd valign\u003d\"top\"\u003e\u003cspan class\u003d\"style10\"\u003eCase 1: 0\u003cbr /\u003e Case 2: 479001600 \u003cbr /\u003e\u003cbr /\u003e\u003c/span\u003e\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"style10\" colspan\u003d\"3\"\u003e\u003chr /\u003e Problem Setter: Sohel Hafiz \u003cbr /\u003e Special Thanks: Shamim Hafiz, Md. Arifuzzaman Arif\u003cbr /\u003e\u003cspan class\u003d\"style11\"\u003eNext Generation Contest 5\u003c/span\u003e\u003c/td\u003e\u003ctd valign\u003d\"top\"\u003e\u0026nbsp;\u003c/td\u003e\u003ctd width\u003d\"1%\"\u003e\u0026nbsp;\u003c/td\u003e\u003ctd width\u003d\"1%\"\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/body\u003e\u003c/html\u003e"}}]}