Algorithmic excursion (excursion)

40 teams scored 3450 points on this task, for a maximum score of 100, an average score of 86 and a median score of 100.

Highlights

  1. Galileo Galilei, Trento is the institute with the most points (300).
  2. Lombardia is the region with the most points (960).

Statement

Giorgio is a passionate hiker, and every weekend goes for an excursion in his beloved mountains: the Alps. Today, he is going to explore the Val Troncea, a nice rectangular valley consisting of H × W square meters of land, each with a different altitude of A[i,j] millimeters above sea level (for i = 0 … H-1, j = 0 … W-1). He will start from one of its corners, labelled (0,0), then he will wander around without following maps nor trails: he will follow an algorithm! More specifically, Giorgio follows six simple rules: (1) No jumps: step only between adjacent squares (in directions North, South, East or West). (2) No flight: never get out of the borders of the valley. (3) No return: never come back to the square from which you just arrived. (4) No cliffs: always choose the square with an altitude closer to the current one (least absolute difference of altitudes)...