atcoder#ARC105E. [ARC105E] Keep Graph Disconnected
[ARC105E] Keep Graph Disconnected
Score : points
Problem Statement
Given is an undirected graph consisting of vertices numbered through and edges numbered through . Edge connects Vertex and Vertex bidirectionally.
is said to be a good graph when both of the conditions below are satisfied. It is guaranteed that is initially a good graph.
- Vertex and Vertex are not connected.
- There are no self-loops and no multi-edges.
Taro the first and Jiro the second will play a game against each other. They will alternately take turns, with Taro the first going first. In each player's turn, the player can do the following operation:
- Operation: Choose vertices and , then add to an edge connecting and bidirectionally.
The player whose addition of an edge results in being no longer a good graph loses. Determine the winner of the game when the two players play optimally.
You are given test cases. Solve each of them.
Constraints
- All values in input are integers.
- The given graph is a good graph.
- In one input file, the sum of and that of do not exceed .
Input
Input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print lines. The -th line should contain First
if Taro the first wins in the -th test case, and Second
if Jiro the second wins in the test case.
3
3 0
6 2
1 2
2 3
15 10
12 14
8 3
10 1
14 6
12 6
1 9
13 1
2 5
3 9
7 2
First
Second
First
- In test case , Taro the first wins. Below is one sequence of moves that results in Taro's win:- In Taro the first's turn, he adds an edge connecting Vertex and , after which the graph is still good.
- Then, whichever two vertices Jiro the second would choose to connect with an edge, the graph would no longer be good.
- Thus, Taro wins.
- In Taro the first's turn, he adds an edge connecting Vertex and , after which the graph is still good.
- Then, whichever two vertices Jiro the second would choose to connect with an edge, the graph would no longer be good.
- Thus, Taro wins.