{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eFor your trip to Beijing, you have brought plenty of puzzle\n books, many of them containing challenges like the following:\n how many triangles can be found in Figure\u0026nbsp;1?\u003c/p\u003e\n \u003cdiv id\u003d\"fig:example_puzzle\" class\u003d\"figure\"\u003e\n \u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/6bf2f1362905162b04e97cdc09c769e5?v\u003d1715544626\" alt\u003d\"\\includegraphics[width\u003d0.38\\textwidth ]{sample1}\" style\u003d\"width:38.00%\"\u003e\n \u003cdiv class\u003d\"caption\"\u003e\n \u003cb\u003eFigure 1\u003c/b\u003e: Illustration of Sample Input 2.\n \u003c/div\u003e\n \u003c/center\u003e\n \u003c/div\u003e\n \u003cp\u003eWhile these puzzles keep your interest for a while, you\n quickly get bored with them and instead start thinking about\n how you might solve them algorithmically. Who knows, maybe a\n problem like that will actually be used in this year’s contest.\n Well, guess what? Today is your lucky day!\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe first line of input contains two integers \u003cspan class\u003d\"tex2jax_process\"\u003e$r$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$c$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq r \\le 3\\, 000$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\le c \\leq 6\\, 000$\u003c/span\u003e), specifying the picture size, where\n \u003cspan class\u003d\"tex2jax_process\"\u003e$r$\u003c/span\u003e is the number of rows\n of vertices and \u003cspan class\u003d\"tex2jax_process\"\u003e$c$\u003c/span\u003e is the\n number of columns. Following this are \u003cspan class\u003d\"tex2jax_process\"\u003e$2r-1$\u003c/span\u003e lines, each of them having at\n most \u003cspan class\u003d\"tex2jax_process\"\u003e$2c-1$\u003c/span\u003e characters.\n Odd lines contain grid vertices (represented as lowercase\n \u003ctt class\u003d\"ttfamily\"\u003ex\u003c/tt\u003e characters) and zero or more\n horizontal edges, while even lines contain zero or more\n diagonal edges. Specifically, picture lines with numbers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$4k+1$\u003c/span\u003e have vertices in\n positions \u003cspan class\u003d\"tex2jax_process\"\u003e$1, 5, 9, 13, \\ldots\n $\u003c/span\u003e while lines with numbers \u003cspan class\u003d\"tex2jax_process\"\u003e$4k+3$\u003c/span\u003e have vertices in positions\n \u003cspan class\u003d\"tex2jax_process\"\u003e$3, 7, 11, 15, \\ldots\n $\u003c/span\u003e\u0026nbsp;. All possible vertices are represented in the\n input (for example, see how Figure\u0026nbsp;1 is represented in\n Sample Input 2). Horizontal edges connecting neighboring\n vertices are represented by three dashes. Diagonal edges are\n represented by a single forward slash (‘\u003ctt class\u003d\"ttfamily\"\u003e/\u003c/tt\u003e’) or backslash (‘\u003ctt\u003e\\\u003c/tt\u003e’) character. The\n edge characters will be placed exactly between the\n corresponding vertices. All other characters will be space\n characters. Note that if any input line could contain trailing\n whitespace, that whitespace may be omitted.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eDisplay the number of triangles (of any size) formed by grid\n edges in the input picture.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\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\u003e3 3\nx---x\n \\ /\n x\n / \\\nx x\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\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\u003e4 10\nx x---x---x x\n \\ / / \\\n x x---x x x\n / \\ / \\ \\\nx x---x---x---x\n / / \\ \\ / \\\n x---x---x---x---x\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e12\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}