#P2867. [USACO06NOV] Big Square S
[USACO06NOV] Big Square S
Description
Farmer John’s cows are competing against Farmer Bob’s cows.
They draw an square lattice of points in the field. Each farm’s cows occupy some points, and of course no two cows can be at the same point.
Each farm aims to use its own cows as the vertices to form a square with the maximum possible area (the square does not need to be axis-aligned).
All of John’s cows except Bessie have already been placed on the lattice. Determine where to place Bessie so that John’s farm can obtain a square with the maximum possible area (Bessie is not required to be one of the four vertices).
Input Format
Line : A single integer ().
Lines to : The -th of these lines uses characters to describe row of the field. J denotes a point occupied by John’s cow, B denotes a point occupied by Bob’s cow, and * denotes an unoccupied point. The input guarantees at least one unoccupied point.
Output Format
Output a single integer, the maximum area that John’s farm can achieve. If no square can be formed, output .
6
J*J***
******
J***J*
******
**B***
******
4
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号