10636 - Stretching Geometry
Moderator: Board moderators
10636 - Stretching Geometry
The problem statement doesn't state anything about the possibility of multiple solutions, which causes me to believe that the input should only contain cases where the solution is unique.
But unless I've made some mistake, my asserts tell me otherwise.
So could anyone clarify this point? Should I handle multiple solutions some way, or have I made a mistake when I probe for occurences of such cases?
But unless I've made some mistake, my asserts tell me otherwise.
So could anyone clarify this point? Should I handle multiple solutions some way, or have I made a mistake when I probe for occurences of such cases?
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
-
- Experienced poster
- Posts: 128
- Joined: Fri Nov 15, 2002 7:45 am
- Location: Kyrgyzstan
Hi!
But how can there be multiple solutions?
There only might be case where there is no solution if the given angle is wrong, but I assumed that the given data is correct. I just directly calculate the coordinates and print'em without any check for their consistency with the input values.
Hope it helps.
Andrey.
But how can there be multiple solutions?


There only might be case where there is no solution if the given angle is wrong, but I assumed that the given data is correct. I just directly calculate the coordinates and print'em without any check for their consistency with the input values.
Hope it helps.
Andrey.
Perhaps I have some fundamental misunderstanding of the problem, but for instance, for the case
I think that there are (at least) the two solutions
Both are at the same angle, so it's impossible to determine which of them is the "best" that way.
I check for multiple solutions by trying different ways to factor ab into a and b, and for each solution I find, I check that it is the same as the previous solution (or that it is the first solution).
Code: Select all
101336342800 339648 8 43121848 1.635755429213964e-07
Code: Select all
101250099104 339648 (using b = 5390231 and a = 8)
50625049552 169824 (using b = 10780462 and a = 4)
I check for multiple solutions by trying different ways to factor ab into a and b, and for each solution I find, I check that it is the same as the previous solution (or that it is the first solution).
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
I think the angle you give is wrong.
For your test case, I get following two solutions for a and b:
a = 5390231 b = 8 5.6922657502e-12
a = 10780462 b = 4 1.2777448241e-11
(the third number is smallest angle)
Here are the coordinates of first and second tree, respectively, if I print them without scaling:
2350 5307 6357 14356
1175 10614 1416 12791
and that is my overall answer:
122121073536 409312
For your test case, I get following two solutions for a and b:
a = 5390231 b = 8 5.6922657502e-12
a = 10780462 b = 4 1.2777448241e-11
(the third number is smallest angle)
Here are the coordinates of first and second tree, respectively, if I print them without scaling:
2350 5307 6357 14356
1175 10614 1416 12791
and that is my overall answer:
122121073536 409312
-
- New poster
- Posts: 11
- Joined: Sun Jan 30, 2005 10:21 pm
Well I am having the same problem you were having (to Per)
How did you solve it?
For the input you gave, I get the two different solutions as well.
What was the problem?
For the input you gave, I get the two different solutions as well.
What was the problem?
Hi,
Sorry for reviving such an old topic, but...
I am getting many WAs. Can I assume that a, b are integers? Or a*d, b*d are integers? Could anyone give me some further hints? Or some test cases? Thanks in advance.
For the cases discussed in posts above, I get the following result:I think they are correct.
Sorry for reviving such an old topic, but...
I am getting many WAs. Can I assume that a, b are integers? Or a*d, b*d are integers? Could anyone give me some further hints? Or some test cases? Thanks in advance.
For the cases discussed in posts above, I get the following result:
Code: Select all
101336342800 339648 8 43121848 1.2777448241e-11
101336342800 339648 8 43121848 5.6922657502e-12
-1 1 -1 1 1.000000000000000e-8
Code: Select all
122121073536 409312
274125587736 918784
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
I change my epsilon to 1e-10 somewhere and get Accepted!! 58 of the 397 submissions to date are by me... 
My Accepted code supposes a, b are integers.

My Accepted code supposes a, b are integers.
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
Amazing how insight can strike suddenly. I must have looked at this problem over 20 times in the past 3 years, without any idea of how to solve it.
This must be the most obfuscated problem in the problemset, which is a big credit for its setter
.
This must be the most obfuscated problem in the problemset, which is a big credit for its setter

The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.