I changed the following in your code, and it now passes all the sample input on the board, plus the sample input from the problem. This should take care of the 0.01 degrees gap mentioned in the problem description.
Code: Select all
AngleRange* getAngleRange(POINT observer, POINT p, double& range)
{
AngleRange* ar = new AngleRange;
double dist = sqrt((observer.y-p.y)*(observer.y-p.y)+(observer.x-p.x)*(observer.x-p.x));
range = asin(radius/dist);
double center = atan2(p.y-observer.y, p.x-observer.x);
ar->from = center - range - (0.005*PI/180); // changed
ar->to = center + range + (0.005*PI/180); // changed
range *= 36000;
return ar;
}
However, your program is slow, and it might get TLE... I also had to make massive (non-algorithmic) changes to get it to compile under GNU C++.
While on the subject, I have WA on this problem. Could anyone with AC give me the output to these cases:
My program outputs 122 and 34, but I'm not sure if my answers are correct. The above program outputs 124 and 34, and according to some other i/o data I have, the answers could be 92 and 28...
Thanks in advance.