Page 1 of 2
10385 - Duathlon
Posted: Sun Oct 27, 2002 8:52 pm
by Jucovschi Constantin
How to solve 10385
Posted: Sun Oct 27, 2002 9:03 pm
by Adil
how about brute force?
10385: POOR description
Posted: Sun Jan 19, 2003 5:18 am
by Miguel Angel
I was doing 10385, then i found something that i need to know
The speed of the contestants is km/h, m/s ??
Without this my algo cannot know the answer.
thanks in advance if someone can tell me

I can answer my question..
Posted: Sun Jan 19, 2003 6:07 am
by Miguel Angel
Km. / H
BTW, i did a mistake in my implementation which got me shock and got me confused about if it was Km/H.
Posted: Tue Jan 28, 2003 12:48 am
by Caesum
Any hints on how to avoid problems with rounding ? I can barely obtain the given answers and then only if I make some assumptions about rounding. If I try to be more accurate then the sample answer appears to be incorrect as it appears to be closer to 14.2839 or 14.28 and yet the answer given is 14.29.......
Posted: Tue Jan 28, 2003 12:57 am
by Caesum
nevermind....... was just my miscomputations........
Re: 10385 - Duathlon
Posted: Mon Sep 07, 2009 7:25 pm
by serur
What's the output for this?
Code: Select all
100
1
2 3
7
2
3 4
4 3
100
9
25 20
40 12
37 23
9 49
17 19
33 5
67 3
34 11
21 30
Re: 10385 - Duathlon
Posted: Mon Sep 07, 2009 9:56 pm
by coze
Hi serur.
I checked with assert that n is greater than 1.
Input:
Code: Select all
7
2
3 4
4 3
100
9
25 20
40 12
37 23
9 49
17 19
33 5
67 3
34 11
21 30
My output:
Code: Select all
The cheater can win by 2099 seconds with r = 7.00km and k = 0.00km.
The cheater can win by 1270 seconds with r = 21.53km and k = 78.47km.
Hope it helps.
Re: 10385 - Duathlon
Posted: Tue Sep 08, 2009 8:47 pm
by serur
Thanks coze. This is my source code, it gets WA. What I did is a ternary search...
Re: 10385 - Duathlon
Posted: Wed Sep 09, 2009 5:26 pm
by coze
Try using "%.0lf" instead of "%d".
Code: Select all
printf("The cheater can win by %.0lf seconds with r = %.2lfkm and k = %.2lfkm.\n",
(f(left)),left,total-left);
Re: 10385 - Duathlon
Posted: Sat Sep 12, 2009 8:36 pm
by serur
Thanks
coze, your suggestion was the very thing. Got it AC at last

Re: 10385 - Duathlon
Posted: Thu Sep 24, 2009 2:10 am
by DeadLock
Re: 10385 - Duathlon
Posted: Thu Sep 24, 2009 5:45 pm
by DeadLock
got accepted, it seems that no case on the judge similar to that one
Re: 10385 - Duathlon
Posted: Sun May 30, 2010 5:43 pm
by SePulTribe
Remember to set precision to 0.001 if using ternary search! Caused me lots of headaches.
Re: 10385 - Duathlon
Posted: Fri Jun 25, 2010 7:49 am
by docardoso
Can someone the idea behind this ternary search solution?
Indeed, I really couldn't figure out how to solve this. I think something related to linear programming would do the job, but i looks like there are much simpler solutions than any using this kind of thing...
So, please, explain me your ideas.
Best regards,
Douglas