| ||This problem contains images which will not display correctly for plugin users. Please use the applet to view the problem statement and examples.
Given a set of two-dimensional points with integer coordinates, determine if they uniquely determine a square. In other words, determine if there is exactly one square that can be constructed so that each specified point is exactly on an edge or vertex of the square. Return "consistent" if exactly one such square exists, "inconsistent" if no such square exists, and return "ambiguous" if more than one such square is possible. To simplify the problem a bit, input will contain at least five points. The coordinates of the points are specified in two ints, x and y. The i'th point is specified by (x[i],y[i]).
Returns "ambiguous" since two squares can be constructed such that each passes through all eight points, as shown in the figure.
|Method signature:||String determine(int x, int y)|
|(be sure your method is public)|
|-||The possible squares may be at any orientation(s).|
|-||x will have between 5 and 50 elements inclusive.|
|-||y will have between 5 and 50 elements inclusive.|
|-||x and y will have the same number of elements.|
|-||Each element of x and y will be between -1000 and 1000 inclusive.|
|-||Each point (x[i],y[i]) must be distinct from all the other points.|
No way to make a square with all the points here.
This is an extremely well determined square.
Exactly one square fits here.
No square is possible.
More than one square is possible. Three of them are shown here.
|Almost a square, but not quite.|