ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1052. Rabbit Hunt

Could anyone help me please, WA on test #4 ?
Posted by za-Nuker[2006] 13 Apr 2006 14:38
Hi, all.

My program is generating all possible lines [ so they are only less or equal to C(n,2) lines were kept ].

I keep 'M' and 'C' of every line, sort them and then count the most appeared lines.

When I count the most appeared lines, I multiplied it by 2, take sqrt and ceil it up. Like this : ans = (int) ceil(sqrt(2.0* max));

Above is from C(n,2) = maxline

I use the formular c = (x1 y2 - x2 y1) / x1-x2

After I received WA#4 the first time, I changed all my code to keep M and C in fraction [ didn't divide it but keep 2 values ] to avoid error from floating point.

I still get WA on test #4. Could anyone give me test case #4 to me, or some of test cases which might help me please?

Thank you all in advance and sorry for my poor English ;-)
Re: Could anyone help me please, WA on test #4 ?
Posted by Madhav 15 Jun 2008 14:57
don't try to use the concept of slope.Try to use the idea that
if 3 points are collinear the area of triangle formed by those  points is 0.Then u can avoid fractions.Note even that double values cannot be compared exactly which lead to WA.So try use the above idea