|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
Alice and Bob are playing Dots and Boxes. The game is played on an N × N square lattice of dots, and they alternate drawing a line segment between horizontally or vertically adjacent dots that haven’t been connected before. Every time a unit square is formed by four line segments, the player who put down the last segment scores one point for that square. The game ends when the square lattice has been completely filled with line segments, and whoever scored the most points wins.
Alice and Bob aren’t really in a competitive mood today, so they’ve just been playing for fun. Hence they aren’t following any specific game strategy, and, in particular, even if it’s possible to make a move that scores a point or is clearly superior in some way, they won’t necessarily make that move. But now they’ve been playing for a while and neither of them has scored a single point. If neither of them scores a point pretty soon, they may get bored. Given the current state of the game, how many moves could be made, in the worst case, before either Alice or Bob is guaranteed to have scored a point?
Input starts with a line containing an integer N (2 ≤ N ≤ 80), the size of the square lattice. Then follows an ASCII representation of the current state of the game, 2N −1 rows high and 2N −1 columns wide, listed in row-major order. There are cells of four types (1 ≤ i, j ≤ N):
It is guaranteed that no player has scored a point, meaning that no unit squares have been formed.
Output the number of moves that can be made, in the worst case, before either Alice or Bob is guaranteed to have scored a point.
3 *-*.* |.|.| *.*-* |...| *.*.*
2 *.* ... *.*
4 *-*-*.* |...|.. *-*-*-* |.....| *.*.*-* |.....| *-*-*-*