10385 - Duathlon
Moderator: Board moderators
-
- New poster
- Posts: 9
- Joined: Sat Oct 26, 2002 6:30 pm
10385 - Duathlon
How to solve 10385
-
- Learning poster
- Posts: 60
- Joined: Tue Aug 13, 2002 2:39 am
- Location: Mexico
10385: POOR description
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![:)](./images/smilies/icon_smile.gif)
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
![:)](./images/smilies/icon_smile.gif)
![:D](./images/smilies/icon_biggrin.gif)
![:D](./images/smilies/icon_biggrin.gif)
-
- Learning poster
- Posts: 60
- Joined: Tue Aug 13, 2002 2:39 am
- Location: Mexico
I can answer my question..
Km. / H
BTW, i did a mistake in my implementation which got me shock and got me confused about if it was Km/H.
BTW, i did a mistake in my implementation which got me shock and got me confused about if it was Km/H.
![:D](./images/smilies/icon_biggrin.gif)
![:D](./images/smilies/icon_biggrin.gif)
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.......
Re: 10385 - Duathlon
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
Hi serur.
I checked with assert that n is greater than 1.
Input:
My output:
Hope it helps.
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
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.
Re: 10385 - Duathlon
Thanks coze. This is my source code, it gets WA. What I did is a ternary search...
Code: Select all
CUT AFTER AC
Last edited by serur on Sat Sep 12, 2009 8:34 pm, edited 1 time in total.
If there is ever a war between men and machines, it is easy to guess who will start it (c) Arthur Clarke
Re: 10385 - Duathlon
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
Thanks coze, your suggestion was the very thing. Got it AC at last ![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
If there is ever a war between men and machines, it is easy to guess who will start it (c) Arthur Clarke
Re: 10385 - Duathlon
what is the output for
Code: Select all
10
2
5 5
10 10
Re: 10385 - Duathlon
got accepted, it seems that no case on the judge similar to that one
-
- New poster
- Posts: 28
- Joined: Mon Nov 15, 2004 5:00 pm
Re: 10385 - Duathlon
Remember to set precision to 0.001 if using ternary search! Caused me lots of headaches.
Re: 10385 - Duathlon
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
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