A Fair Rock Game (fairgame)

82 teams scored 1450 points on this task, for a maximum score of 100, an average score of 18 and a median score of 10.

Highlights

  1. R. Donatelli, Terni is the institute with the most points (120).
  2. Emilia-Romagna is the region with the most points (260).

Statement

Alice and Bob are playing a game: they have a pile of N rocks, and in every turn the current player takes at least 1 rock and at most K rocks. Alice makes the first move, then Bob does the second, and so on as they alternate turns. If one player takes an odd number of rocks, he has to pay M euros. When the pile is empty, the player who made the last move gets P euros and the other one gets Q euros. After the game ends, Alice will end up with an amount of euros, let's call it X, and Bob will end up with another amount of euros, let's call it Y. They both play optimally, which means Alice wants to maximize the value X - Y and Bob wants to minimize it. Find out the value of X - Y.