|
|
in fact,we must regard plane is exactly on the surface of the earth so that we can get ac... I think that test 16 have at least two codirectional vectors. Incorrect test is fixed. Thank you. My algorithm is as follows: I consider planes that cut the sphere in half - they are determined by two points in the input and the center of the sphere. I split the input points in three sets according to this plane - points "above" the plane (say N1 points), points "under" the plane (say N2 points) and points in the plane (all of them being on one circle). Obviously at this moment these points on this circle are not visible since they aren't on the open emisphere, so I try to move this emisphere just a little to make the maximum number of points visible. To handle this, I find the maximum number of points P on some semi-circle. So I conclude that the maximum number of visible points using this plane is the maximum between N1+P and N2+P. Can you give me a case for which this algorithm is not correct? I get WA on test-case 7. Thanks. Your algorithm is correct. Try these tests: Input #1: 1 0 0 1 Output #1: 1 Input #2: 3 0 0 1 0 0 100 0 0 600 Output #2: 3 Test #2 is incorrect, isn't it? "There is not more than one plane at each point of the Earth's surface." i don't understand the problem. i think, if to keep far away enought we can see any five of points i am right? Slow Ac O(N^3*log(N)) O(N^2) -choice plane through two poins and the centre; O(N*log(N)) -searching semicircle with max number of points How make more quickly? To AC it I've used some analog of hash tables when applied second of your algos (O(N^2)). If points A and B are between two points that we check (on a small arc), then we may not check them in the future. Such a trick helped me to AC the problem in 0.14 secs. |
|
|