The Jeweller's Game (gemgame)

9 teams scored 450 points on this task, for a maximum score of 60, an average score of 50 and a median score of 60.

Highlights

  1. U. Dini, Pisa is the institute with the most points (60).
  2. Lombardia is the region with the most points (240).

Statement

John is playing the new hit mobile game: "The Jeweller's Game". In this game, there is an N × N board full of different kinds of gems. Let's denote by (r, c) the cell located at the r-th row and c-th column of the board. Each cell of the board contains a gem. The type of the gem in cell (r,c) is represented by a positive integer G_r,c. We group the cells according to the following rule. Cells a and b are in the same group if and only if there exists a sequence of cells p_0, …, p_k such that: (1) p_0 = a and p_k = b, and (2) cells p_i-1 and p_i are edge-adjacent and are of the same type for each i = 1, …, k. Note that every cell belongs to exactly one group. The player can improve their score by swapping edge-adjacent cells of the board. Depending on whether the two swapped cells are in the same row or in the same column, we call a swap either horizontal or vertical, respectively. If the two swapped gems are of the same type, then the score of the swap is 0...