問題一覧 > 通常問題

No.2044 Infinite Nim

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 139
作問者 : 👑 箱星 / テスター : 👑 hitonanode platinum
お気に入りにしたユーザー ProblemId : 7207 / 自分の提出
問題文最終更新日: 2022-08-09 22:12:20
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 357 (順位表) の他の問題:

Problem Statement

There are $N$ piles of stones, and the $i$-th pile contains $A_i$ stones. Note that the number of stones can be infinite. $A_i=−1$ means that the $i$-th pile contains infinitely many stones.

Sente Taro and Gote Jiro play a game. Starting with Sente Taro, they alternately perform the following operation.

  • Choose $1$ pile that contains at least $1$ stone and remove at least $1$ stone from it, so that the number of stones in the chosen pile becomes finite.

    More precisely, when a pile with $x$ stones is chosen: if $x$ is finite, choose $1$ non-negative integer $y$ satisfying $y\lt x$ and set the number of stones in this pile to $y$. If $x$ is infinite, choose $1$ non-negative integer $y$ and set the number of stones in this pile to $y$.

The player who first becomes unable to make a move loses. Determine which of the $2$ players wins when they act optimally.

Constraints

  • $1\le N\le 10^5$
  • $1\le A_i\le 10^9$ or $A_i=-1$
  • All input values are integers

Input

$N$
$A_1$ $A_2$ $\ldots$ $A_N$

Output

Print First if Sente Taro wins, and Second if Gote Jiro wins.

Sample

Sample 1
Input
4
1 3 5 7
Output
Second

The numbers of stones are finite.

Sample 2
Input
2
1 -1
Output
First

Sente Taro can remove stones from pile number $2$, which contains infinitely many stones, so that this pile contains $1$ stone.

Sample 3
Input
8
123 -1 456 -1 789 -1 -1 -1
Output
First

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。