Problem

Source: Iranian National Olympiad (3rd Round) 2007

Tags: algorithm, geometry proposed, geometry



In the following triangular lattice distance of two vertices is length of the shortest path between them. Let $ A_{1},A_{2},\dots,A_{n}$ be constant vertices of the lattice. We want to find a vertex in the lattice whose sum of distances from vertices is minimum. We start from an arbitrary vertex. At each step we check all six neighbors and if sum of distances from vertices of one of the neighbors is less than sum of distances from vertices at the moment we go to that neighbor. If we have more than one choice we choose arbitrarily, as seen in the attached picture. Obviusly the algorithm finishes a) Prove that when we can not make any move we have reached to the problem's answer. b) Does this algorithm reach to answer for each connected graph?


Attachments: