{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"有一个r * c的网格,n个障碍物,问有几个四联通区域(即上下左右有任一条边相连),以及每个联通区域的网格数。(网格的坐标从1开始)"}},{"title":"Input","value":{"format":"HTML","content":"第一行有一个整数T(T \u003c\u003d 10),表示有T组测试数据。\u003cbr/\u003e\n\n对于每组测试样例,第一行有两个整数r和c(0 \u003c\u003d r, c \u003c\u003d 1e9),表示网格有r行c列。 \n\u003cbr/\u003e\n第二行有一个整数n(n \u003c\u003d 200),表示障碍物的数量。\u003cbr/\u003e\n\n接下来n行,每行有两个整数x和y,表示对应障碍物的坐标。"}},{"title":"Output","value":{"format":"HTML","content":"对于每组数据, 首先输出一行\"Case #x:\", x是数据序号( 从1开始)。\u003cbr/\u003e\n第二行输出联通块数量 n。\u003cbr/\u003e\n第三行按升序输出n个数,代表每个连通块的网格数。"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e\u003cpre\u003e2\n\n3 3\n2\n1 2\n2 1\n\n3 3\n1\n2 2\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003eCase #1:\n2\n1 6\nCase #2:\n1\n8\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}