{"trustable":false,"prependHtml":"","sections":[{"title":"","value":{"format":"HTML","content":"Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 \u0026lt;\u003d N \u0026lt;\u003d 500). The grid contains K asteroids (1 \u0026lt;\u003d K \u0026lt;\u003d 10,000), which are conveniently located at the lattice points of the grid.\n\u003cbr\u003e\n\u003cbr\u003eFortunately, Bessie has a powerful weapon that can vaporize all the asteroids in any given row or column of the grid with a single shot.This weapon is quite expensive, so she wishes to use it sparingly.Given the location of all the asteroids in the field, find the minimum number of shots Bessie needs to fire to eliminate all of the asteroids.\n\u003chr/\u003e\n\u003cp\u003eBessie 希望能驾驶她的飞船穿过一段危险地带,这块地带可以看作是一个 $N\\times N\\ (1\\le N\\le 500)$ 的网格,其中有 $K\\ (1\\le K\\le 10000)$ 颗小行星。\u003c/p\u003e\n\u003cp\u003e还好 Bessie 有一把强力的武器,每次能够发射一道光束,将某行或者某列上的所有小行星轰成灰烬。 但由于武器价格高昂,所以她希望发射的光束数量尽可能少。问发射的光束最少数量是多少?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"* Line 1: Two integers N and K, separated by a single space.\n\u003cbr\u003e* Lines 2..K+1: Each line contains two space-separated integers R and C (1 \u0026lt;\u003d R, C \u0026lt;\u003d N) denoting the row and column coordinates of an asteroid, respectively."}},{"title":"Output","value":{"format":"HTML","content":"* Line 1: The integer representing the minimum number of times Bessie must shoot."}},{"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\u003e3 4\n1 1\n1 3\n2 2\n3 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"INPUT DETAILS:\n\u003cbr\u003eThe following diagram represents the data, where \"X\" is an asteroid and \".\" is empty space:\n\u003cbr\u003e\u003ctt\u003eX.X\n\u003cbr\u003e.X.\n\u003cbr\u003e.X.\u003c/tt\u003e\n\u003cbr\u003e\n\u003cbr\u003eOUTPUT DETAILS:\n\u003cbr\u003eBessie may fire across row 1 to destroy the asteroids at (1,1) and (1,3), and then she may fire down column 2 to destroy the asteroids at (2,2) and (3,2)."}}]}