Woburn Challenge 2001 - Suicidal
This is the first day of orientation and the frosh are already ready to
isolate themselves. Therefore, they have been divided into
To begin the game, a random number will be drawn from a hat to represent the number of turns that will take place before the game is declared over. During each turn, each tribe will alternately position one of their students at one of the grid positions.
The goal is as follows. If you draw a straight line between students of
the same tribe, it might turn out that
The tribe that forms that largest area wins and the losing tribe is kicked off the island (translation: kicked out of Waterloo engineering). Note that this event has been approved by Waterloo faculty as a much more efficient method of weeding out students from first year engineering.
Input Specification
The next *
means an unoccupied grid position, k
represents a Keeg
student, d
represents a Dren student.
The next line of input is either k
or d
. You must place a student of
the appropriate tribe (depending on whether the input is k
or d
) on
a position on the grid to come up with the square of maximum area.
Output Specification
The area of the largest such square that can be formed by the addition of the last student of the appropriate tribe.
Sample Input
4
*k**
**k*
*k*d
**d*
k
-1
Sample Output
2
NOTE: this is obtained by placing k
at row
Comments