IMO Shortlist 2015 problem C4

  Avg: 0,0
  Avg: 7,0

Let n be a positive integer. Two players A and B play a game in which they take turns choosing positive integers k \le n. The rules of the game are:

(i) A player cannot choose a number that has been chosen by either player on any previous turn.
(ii) A player cannot choose a number consecutive to any of those the player has already chosen on any previous turn.
(iii) The game is a draw if all numbers have been chosen; otherwise the player who cannot choose a number anymore loses the game.

The player A takes the first turn. Determine the outcome of the game, assuming that both players use optimal strategies.