{"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\u003eTheodore implements a new strategy game “Defense of a Kingdom”. On each level a player defends the\u0026nbsp;Kingdom that is represented by a rectangular grid of cells. The player builds crossbow towers in some\u0026nbsp;cells of the grid. The tower defends all the cells in the same row and the same column. No two towers\u0026nbsp;share a row or a column.\u003c/p\u003e\r\n\r\n\u003cp\u003eThe penalty of the position is the number of cells in the largest undefended rectangle. For example, the\u0026nbsp;position shown on the picture has penalty 12.\u003c/p\u003e\r\n\r\n\u003cp\u003e\u003cimg title\u003d\"Example position\" src\u003d\"CDN_BASE_URL/87510832fe690c99e15afdf40381c03d?v\u003d1715626677\" alt\u003d\"This position has a penalty of 12.\" width\u003d\"658\" height\u003d\"239\"\u003e\u003c/p\u003e\r\n\r\n\u003cp\u003eHelp Theodore write a program that calculates the penalty of the given position.\u003c/p\u003e\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eThe first line of the input file contains the number of test cases.\u003c/p\u003e\r\n\u003cp\u003eEach test case consists of a line with three integer numbers: w — width of the grid, h — height of the\u0026nbsp;grid and n — number of crossbow towers (1 ≤ w, h ≤ 40 000; 0 ≤ n ≤ min(w, h)).\u003c/p\u003e\r\n\u003cp\u003eEach of the following n lines contains two integer numbers x\u003csub\u003ei\u003c/sub\u003e and y\u003csub\u003ei\u003c/sub\u003e — the coordinates\u0026nbsp;of the cell occupied by a tower (1 ≤ x\u003csub\u003ei\u003c/sub\u003e ≤ w; 1 ≤ y\u003csub\u003ei\u003c/sub\u003e ≤ h).\u003c/p\u003e\r\n\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each test case, output a single integer number — the number of cells in the largest rectangle that is not defended by\u0026nbsp;the towers.\u003c/p\u003e\r\n\r\n\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\u003e1\r\n15 8 3\r\n3 8\r\n11 2\r\n8 6\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e12\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}