Page 2 of 2

Re: 11262 - Weird Fence

Posted: Thu Dec 04, 2014 9:14 am
by lehuyduc
I've found the mistake, it's not about the precision error. I forgot to add some edges :D. Thanks for helping anyway.

Re: 11262 - Weird Fence

Posted: Fri Jul 22, 2016 7:40 pm
by catweazle352

I did a binary search answer. I only used integer arithmetic. Providing my code with the sample input of udebug results in a correct answer. I even generated random input on myself and tested it on udebug, my output was always correct.

I now heavily documented my code and hope that someone give my a hint or at least a critical test case:

Code: Select all

removed after AC
My mistake was to use a greedy algorithm to get a matching. Unfortunately the input provided on udebug did not reveal that error, it seems to be that greedy (first sorting blue-red connections by distance) is quite good (but not good enough, of course).

I provided an additionally set of input data on udebug in order to reveal such mistakes in the future.