At first I guess if there are infinitely many great circles passing through the 2 cities I should answer "undefined". But I find that for the sample input,
Code: Select all
10,0N 129,30E 10,0S 50,30W
If so, why is the answer "undefined"? Thanks!
Moderator: Board moderators
Code: Select all
10,0N 129,30E 10,0S 50,30W
Code: Select all
90,0S 0,0W 90,0N 0,0W
I don't understand. There's only one shortest route (as implied by the definition in the question). You can argue that any route that circumnavigates the globe and returns to the same place is a great circle, in which case the answer would be "undefined." But that'd be a really unfair case to test, given the statement of the problem.misof wrote:Also, if the two cities are equal, there are many possible great circles, but the answer is unique -- the latitude of the city. (However, I'm not sure whether there are such test cases.)
My point was: Even if you DID argue that there are infinitely many great circles for these two points, according to the problem statement the answer is still DEFINED, because it is the same for all possible great circles. In other words, I understand the definition in the same way you do, I was just trying to show that this is a special case that may need to be handled on its own.gvcormac wrote:I don't understand. There's only one shortest route (as implied by the definition in the question). You can argue that any route that circumnavigates the globe and returns to the same place is a great circle, in which case the answer would be "undefined." But that'd be a really unfair case to test, given the statement of the problem.misof wrote:Also, if the two cities are equal, there are many possible great circles, but the answer is unique -- the latitude of the city. (However, I'm not sure whether there are such test cases.)
Sadly, we didn't know this during the contest, so we had to deal with the case I mentionedgvcormac wrote:The origin and destination are distinct in all the judge test cases.
Consider the source/destination 0N, 0W. One circle goes throught the north and southmisof wrote:My point was: Even if you DID argue that there are infinitely many great circles for these two points, according to the problem statement the answer is still DEFINED, because it is the same for all possible great circles. In other words, I understand the definition in the same way you do, I was just trying to show that this is a special case that may need to be handled on its own.gvcormac wrote:I don't understand. There's only one shortest route (as implied by the definition in the question). You can argue that any route that circumnavigates the globe and returns to the same place is a great circle, in which case the answer would be "undefined." But that'd be a really unfair case to test, given the statement of the problem.misof wrote:Also, if the two cities are equal, there are many possible great circles, but the answer is unique -- the latitude of the city. (However, I'm not sure whether there are such test cases.)
Sadly, we didn't know this during the contest, so we had to deal with the case I mentionedgvcormac wrote:The origin and destination are distinct in all the judge test cases.
Why don't you trust me when I say that we want to say exactly the same thing?gvcormac wrote:Consider the source/destination 0N, 0W. One circle goes throught the north and south
poles; another goes around the equator. They don't have the same most northerly point.
So, while I don't think there's any real confusion about the meaning of the question,
your interpretation would give "undefined" for source == destination != n/s pole.
Sorry, I don't understand your point at all. Are you trying to make the (obscure) point that there are an infinite number of 0-length arcs at a given point? I can't see how anybody could be confused by this.misof wrote:Why don't you trust me when I say that we want to say exactly the same thing?gvcormac wrote:Consider the source/destination 0N, 0W. One circle goes throught the north and south
poles; another goes around the equator. They don't have the same most northerly point.
So, while I don't think there's any real confusion about the meaning of the question,
your interpretation would give "undefined" for source == destination != n/s pole.![]()
Meanwhile, Christian was able to write it more clearly than I did. I agree with him that the first definition is logical -- if you want to get from A to A, you wouldn't fly around the earth to get there.
My interpretation of the problem statement:
Consider all shortest paths lying on some great circle passing through both given points. If the answer for all of them is the same, output it, otherwise output "undefined". In the case you mention, for both (in fact, for all possible) great circles the shortest path has lenght 0 and the answer is the latitude of the city, i.e. zero.
Phew. Just wanted to make it clear finally
Oh my... Sorry that I caused you that much confusion.gvcormac wrote:Sorry, I don't understand your point at all. Are you trying to make the (obscure) point that there are an infinite number of 0-length arcs at a given point? I can't see how anybody could be confused by this.