Page 1 of 1
10585 - Center of symmetry
Posted: Sat Dec 20, 2003 5:29 am
by windows2k
How to solve the problem?
I first thought matching every possible solution, O(n^2) , it must be TLE.
then I thought sorting by angle, still can't find any relation.
Could someone offer me a hint? Thx

Posted: Sat Dec 20, 2003 10:08 am
by Farid Ahmadov
You have to check just from one point to all other points if the center of mass lies between this points. If there is no such points then answer is no.
Posted: Sat Dec 20, 2003 10:16 am
by windows2k
Farid Ahmadov wrote:You have to check just from one point to all other points if the center of mass lies between this points. If there is no such points then answer is no.
what do you mean?
I choose a point randomly, then find the center of mass lies on the other points?
@@~~
Posted: Sun Dec 21, 2003 4:05 am
by Per
Hint: if the center of symmetry exists, then it is very easy to find.
Posted: Sun Dec 21, 2003 12:37 pm
by Farid Ahmadov
hint: Just find mass center. If its coords x and y are of form d.5 or d.0 then it can be center of symmetry.
Posted: Sun Dec 21, 2003 5:54 pm
by Tomson
hint: you could sort all the points first of all.
10585
Posted: Fri Jan 21, 2005 2:10 am
by diac_paul
I know how the solve the problem, at least i have the idea. the problem is that i have to use the function "atan2(y,x);" - that is in C. I must include "math.h", i know, i did that but i get complietion error. Please how can i use this function?.
Thanks.
Posted: Fri Jan 21, 2005 10:12 am
by little joey
You have to link it explicitly using the compiler switch "-lm".
If you are using gcc, the command would be:
or something like that.
Posted: Fri Jan 21, 2005 9:14 pm
by diac_paul
I know about -lm, but how can I use this on the judge system? Can I put something like "-lm" at the "Comment" when i submit?
Thanks again.
Posted: Sat Jan 22, 2005 9:41 am
by little joey
The judge always compiles with this option, so you don't have to do anything.
If you get compilation error from the judge, it has nothing to do with including math.h, but maybe something else is wrong? Look at the reply sent back to you by the judge.
Posted: Sat Jan 22, 2005 1:26 pm
by diac_paul
Yes, i figured it out.... I was using M_PI witch should be the pi constant (it probably works only in borland C, or i dont't know...) . But
where do i see the "reply sent back to me by the judge"? . It just shows Compilation error.
Posted: Sat Jan 22, 2005 2:52 pm
by little joey
It depends on your personal settings. If you choose to let the judge send a reply to your email address, you'll get an email explaining the result, including the compiler output in case of compilation error. That can be quite helpful, especially if you don't use gcc.