{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003e\r\nThe northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is divided into square blocks, each of them either filled by rock, or free. There is also a little hook on the floor in the center of every free block. The ACM have found that two of the hooks must be connected by a rope that runs through the hooks in every block on the path between the connected ones. When the rope is fastened, a secret door opens. The problem is that we do not know which hooks to connect. That means also that the necessary length of the rope is unknown. Your task is to determine the maximum length of the rope we could need for a given labyrinth.\u003c/p\u003e\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eThe input consists of \u003cvar\u003eT\u003c/var\u003e test cases. The number of them (\u003cvar\u003eT\u003c/var\u003e) is given on the first line of the input file.\r\nEach test case begins with a line containing two integers \u003cvar\u003eC\u003c/var\u003e and \u003cvar\u003eR\u003c/var\u003e (\u003cvar\u003e3 \u0026lt;\u003d C, R \u0026lt;\u003d 1000\u003c/var\u003e) indicating the number of columns and rows. Then exactly \u003cvar\u003eR\u003c/var\u003e lines follow, each containing \u003cvar\u003eC\u003c/var\u003e characters. These characters specify the labyrinth. Each of them is either a hash mark (\u003ccode\u003e#\u003c/code\u003e) or a period (\u003ccode\u003e.\u003c/code\u003e). Hash marks represent rocks, periods are free blocks. It is possible to walk between neighbouring blocks only, where neighbouring blocks are blocks sharing a\u0026nbsp;common side. We cannot walk diagonally and we cannot step out of the labyrinth. \r\n\r\n\u003c/p\u003e\u003cp\u003e\r\nThe labyrinth is designed in such a way that there is exactly one path between any two free blocks. Consequently, if we find the proper hooks to connect, it is easy to find the right path connecting them.\r\n\r\n\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eYour program must print exactly one line of output for each test case. The line must contain the sentence \"\u003ccode\u003eMaximum rope length is \u003cvar\u003eX\u003c/var\u003e.\u003c/code\u003e\" where \u003cvar\u003eX\u003c/var\u003eis the length of the longest path between any two free blocks, measured in blocks.\r\n\r\n\u003c/p\u003e\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n3 3\r\n###\r\n#.#\r\n###\r\n7 6\r\n#######\r\n#.#.###\r\n#.#.###\r\n#.#.#.#\r\n#.....#\r\n#######\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eMaximum rope length is 0.\r\nMaximum rope length is 8.\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\r\n\r\n\u003cb\u003eWarning: large Input/Output data, be careful with certain languages\u003c/b\u003e\n\u003c/div\u003e"}}]}