Official

F - RGB Card Game Editorial by evima


Let us call a color advantageous to a player when both players have at least one card in that color and the player has fewer cards in that color than the opponent.
Additionally, let us call a color balanced when both players have at least one card in that color and the same number of cards in that color.

Let \(A_{\mathrm{num}}\), \(B_{\mathrm{num}}\), and \(C_{\mathrm{num}}\) be the number of colors advantageous to Takahashi, advantageous to Aoki, and balanced, respectively. Additionally, let \(A_{\mathrm{sum}}\), \(B_{\mathrm{sum}}\), and \(C_{\mathrm{sum}}\) be the sum of \(\min \lbrace \)the number of cards in Takahashi’s hand, the number of cards in Aoki’s hand\( \rbrace\) over colors advantageous to Takahashi, advantageous to Aoki, and balanced, respectively.

It can be proved by induction that the winner can be determined by division into four cases based on \(C_{\mathrm{num}}\) as follows. Here, in each case, items listed earlier have priority over those listed later.

・When \(C_{\mathrm{num}} = 0\)

  • If \(A_{\mathrm{sum}} \geq B_{\mathrm{sum}}\), Takahashi wins; if \(A_{\mathrm{sum}} \lt B_{\mathrm{sum}}\), Aoki wins.

・When \(C_{\mathrm{num}} = 1\)

  • If \(A_{\mathrm{num}} = 2\), Takahashi wins; if \(B_{\mathrm{num}}=2\), Aoki wins.
  • If \(A_{\mathrm{sum}} - B_{\mathrm{sum}} \geq C_{\mathrm{sum}}\), Takahashi wins; if \(A_{\mathrm{sum}} - B_{\mathrm{sum}} \leq -C_{\mathrm{sum}}\), Aoki wins.
  • If \(A_{\mathrm{sum}} + B_{\mathrm{sum}} + C_{\mathrm{sum}}\) is odd, Takahashi wins; if it is even, Aoki wins.

・When \(C_{\mathrm{num}} = 2\)

  • If \(A_{\mathrm{num}} = 1\), Takahashi wins; if \(B_{\mathrm{num}} = 1\), Aoki wins.
  • If \(C_{\mathrm{sum}}\) is odd, Takahashi wins; if it is even, Aoki wins.

・When \(C_{\mathrm{num}} = 3\)

  • If \(C_{\mathrm{sum}}\) is even, Takahashi wins; if it is odd, Aoki wins.

posted:
last update: