Блог пользователя keylimepie

Автор keylimepie, 12 лет назад, По-английски

Here is the link to the problem:

https://icpcarchive.ecs.baylor.edu/index.php?option=onlinejudge&page=show_problem&problem=2861

With a little searching I found out that such point for a triangle is called a Fermat/Torricelli Point, but I couldn't find a specific algorithm or any implementation for it.

Also, in the editorial for this contest, a single line is written saying that this could be solved using Lami's Theorem(in Physics).

I wasn't able to figure out a solution.

Please Help !

Thanks

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
12 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This is not exactly Fermat point, because the longest distance is traversed only once while the other two are traversed twice. For example, if is an equilateral triangle with side length 2, the Fermat point is clearly the center of the triangle, . But the sought point G is actually closer to one side, namely (or the equivalent points near the two other sides). (Note that I haven't made sure this is correct; I assumed G's x-coordinate is 1 and found the y-coordinate accordingly. It's possible that G's x-coordinate is different.)

My idea would be to test three cases, on whether the path traversed only once is GA, GB, GC. On each case, I would first compute the general formula by hand, then just code the resulting formula for an O(1) solution. However, finding this general formula is the hard part; this seems to require multivariable calculus (location of G has two arguments, xG and yG, and we want to minimize a certain function on these two variables), and I'm forgetting my calculus lessons already.

»
12 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Have you tried purely numeric methods? E.g. pick a starting point, compute derivatives of total distance by x and y, move a bit in the direction in which the derivatives decrease, repeat with sufficiently many smartly chosen starting points?