#K50097. Grid Game
Grid Game
Grid Game
In this problem, you are given an (N \times M) grid where each cell contains a non-negative integer. Two players play a turn-based game with the following rule: on each turn, a player may pick any cell in the grid and increment its value by 1. The game ends when all the cells in the grid have the same value. The player who is unable to make a move (because the grid is already equalized) loses the game.
Under optimal play, the outcome is decided by the total number of moves required to equalize the grid. Let (G_{i,j}) be the value in the cell at row (i) and column (j), and let (\max(G)) be the maximum value in the grid. Then, the total number of moves required is given by:
[ \text{moves} = \sum_{i=1}^{N} \sum_{j=1}^{M} (\max(G) - G_{i,j}) ]
If the total number of moves is odd, the first player wins; otherwise, the second player wins.
Your task is to determine the winner of the game.
inputFormat
The input is read from (stdin) and starts with a line containing two integers (N) and (M) ((1 \leq N, M \leq 500)), representing the number of rows and columns of the grid. This is followed by (N) lines, each containing (M) space-separated non-negative integers (each at most (10^9)) representing the grid.
outputFormat
Output a single line to (stdout): Print First
if the first player wins under optimal play; otherwise, print Second
.## sample
2 2
1 2
2 2
First