题目描述
Problem Description
There are $ N $ large bowls arranged in a row. Let's call the $i\ (0\ ≦\ i\ ≦\ N-1)$ bowl from the left bowl $ i $. Bowl $i\ (1\ ≦\ i\ ≦\ N-1)$ has an integer $ C_i $ written on it and contains $ A_i $ beans. Bowl $ 0 $ has no integer written on it and contains no beans. A brother and sister who love games are going to play a game using these bowls and beans as follows:
- On their turn, a player picks one bean from any bowl except bowl $ 0 $.
- When a bean is picked from bowl $ i $, the player must place it in one of the bowls $i\ -\ C_i$, bowl $i\ -\ C_i\ +\ 1$, ..., bowl $ i-1 $.
- Players alternate turns, and the player who cannot make a move loses (the other player wins).
When both players aim to win and play optimally, will the first or second player win?
Input Format
The input is given from the standard input in the following format:
$ N $ $ C_1 $ $ A_1 $ $ C_2 $ $ A_2 $ : $ C_{N-1} $ $ A_{N-1} $
- The first line contains an integer $N\ (2\ ≦\ N\ ≦\ 10^5)$, representing the number of bowls.
- The next $ N-1 $ lines contain the information about the bowls. The $i\ (1\ ≦\ i\ ≦\ N-1)$ line contains two integers $C_i\ (1\ ≦\ C_i\ ≦\ i)$ and $A_i\ (0\ ≦\ A_i\ ≦\ 10^9)$, indicating that bowl $ i $ has the integer $ C_i $ written on it and contains $ A_i $ beans. It is guaranteed that there is at least one bean in some bowl, i.e., the sum of $ A_i $ is not zero.
Output Format
Output First if the first player wins, or Second if the second player wins, in one line. End the output with a newline.
Sample Input and Output
Sample Input #1
3
1 0
1 1
Sample Output #1
Second
Sample Input #2
7
1 1
2 0
1 0
2 0
4 1
3 0
Sample Output #2
First
Sample Input #3
7
1 1
2 0
1 9
2 10
4 3
3 5
Sample Output #3
Second
Notes/Hints
Partial Points
This problem has partial points.
- If you solve the dataset $ 1 $ where $N\ ≦\ 100$ and $A_i\ ≦\ 10$, you get $ 80 $ points.
- If you solve the dataset $ 2 $ where $N\ ≦\ 100$, you get an additional $ 20 $ points.
- If you solve all test cases, you get an additional $ 4 $ points.
Sample Explanation 1
The game proceeds as follows:
- Turn 1: The first player picks a bean from bowl $ 2 $ and places it in bowl $ 1 $.
- Turn 2: The second player picks a bean from bowl $ 1 $ and places it in bowl $ 0 $.
- Turn 3: The first player cannot pick a bean, so they lose.
In this example, each player has only one choice per turn, leading to this outcome.
Sample Explanation 2
The game proceeds as follows:
- Turn 1: The first player picks a bean from bowl $ 5 $ and places it in bowl $ 4 $.
- Turn 2: The second player picks a bean from bowl $ 4 $ and places it in bowl $ 2 $.
- Turn 3: The first player picks a bean from bowl $ 2 $ and places it in bowl $ 1 $.
- Turn 4: The second player picks one bean from bowl $ 1 $ and places it in bowl $ 0 $.
- Turn 5: The first player picks a bean from bowl $ 1 $ and places it in bowl $ 0 $.
- Turn 6: The second player cannot pick a bean, so they lose.
In other scenarios, no matter what the second player does, the first player can always win by making the appropriate moves.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分