10585 - Center of symmetry

All about problems in Volume 105. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

10585 - Center of symmetry

Post 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 :D

Farid Ahmadov
Experienced poster
Posts: 131
Joined: Thu Apr 17, 2003 8:39 am
Location: Baku, Azerbaijan

Post 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.
_____________
NO sigNature

windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Post 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?
@@~~

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per »

Hint: if the center of symmetry exists, then it is very easy to find.

Farid Ahmadov
Experienced poster
Posts: 131
Joined: Thu Apr 17, 2003 8:39 am
Location: Baku, Azerbaijan

Post 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.
_____________
NO sigNature

Tomson
New poster
Posts: 12
Joined: Wed Mar 19, 2003 2:03 pm

Post by Tomson »

hint: you could sort all the points first of all.

diac_paul
New poster
Posts: 10
Joined: Fri Nov 05, 2004 12:07 pm
Location: Iasi, Romania
Contact:

10585

Post 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.

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

You have to link it explicitly using the compiler switch "-lm".
If you are using gcc, the command would be:

Code: Select all

gcc -lm p10585.c
or something like that.

diac_paul
New poster
Posts: 10
Joined: Fri Nov 05, 2004 12:07 pm
Location: Iasi, Romania
Contact:

Post 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.

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post 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.

diac_paul
New poster
Posts: 10
Joined: Fri Nov 05, 2004 12:07 pm
Location: Iasi, Romania
Contact:

Post 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.

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post 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.

Post Reply

Return to “Volume 105 (10500-10599)”