|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|0.5 초||512 MB||25||13||13||52.000%|
Together with an ornithologist friend, you are spending hours bird-watching in wetlands, waiting for a rare bird that you want to take a picture of.
In order to kill time, you devised a little game. The wetland is represented by an N × N grid made of 3 types of squares: firm ground, wet zone, and protected zone.
Connected wet zone squares form wet areas, which are maximal sets of wet zone squares such that we can go from any square of the area to any other square of the area by a path of connected wet zone squares. Two squares are considered connected when they share one edge, so that squares not on the border of the grid are connected to 4 other squares. Each wet area must be connected to both the left and right sides of the grid, and does not contain more than 2N wet zone squares. Two wet zone squares that belong to two different wet areas will always be at distance at least 3 from each other, the distance being counted by moving horizontally or vertically on the grid. For example, in the two examples below, the blue squares are at distance 3 from one another.
One after the other, you and your friend will each take turns placing a camera on the wetland with the following constraints:
The first player who cannot place a camera anymore loses the game.
Assuming both players play optimally, will the first player win or lose?
The input consists of the following lines:
The four words “First player will win” if the first player wins the game provided both players play optimally, or “Second player will win” otherwise.
The input satisfies 1 ≤ N ≤ 10.
3 ... ... ***
First player will win
The first player can place a camera in three possible places: if he places a camera in the left or right position, then the second player can place one in the other position, and wins the game. On the other hand, if the first player places a camera in the middle, the second player cannot place another camera and loses.
10 ********** *.x.*..... *...*..... *****..... .......... .......... xx******.. ***x...*.. ..*...x*.x ..********
Second player will win