An RGB Masterpiece (grid)

83 teams scored 3655 points on this task, for a maximum score of 100, an average score of 44 and a median score of 44.

Highlights

  1. Banfi, Vimercate is the institute with the most points (314).
  2. Lombardia is the region with the most points (998).

Statement

Ovidiu is a fan of pixel art and is particularly interested in RGB grids. An RGB grid consists of a rectangular grid where every cell is coloured either red, green, or blue. He also figured out that, in order to create a masterpiece, the following rules have to be followed: (1) The grid has N rows and M columns. (2) There are exactly R red cells, G green cells and B blue cells. (3) There are no cells that share a side and have the same colour. However, Ovidiu isn't able to create one himself, and he asked for your help. Can you tell if a masterpiece exists and, if so, produce one?