ÀÂÒ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

412. Texture

Time Limit: 2 seconds
Memory Limit:64000KB
Points:10
View Problem Statistics Submit Problem added Undefined

Statement

Square raster image is represented by an array of N × N pixels. A texture tile is a square image in which the first row is equal to the last one, and the first column is equal to the last one. This property is valuable when covering the surface of graphics object with repeating copies of texture, because it allows "seamless" transitions between tiles.

Your program must, given an image, find its largest subimage which is a texture tile.

Input

Input file contains integer N followed by N2 numbers ci, j — pixel values.

Output

Output file must contain numbers p q m — coordinates of top left corner and size of the largest texture tile. If several solutions exist, output any of them.

Constraints

1 ≤ N ≤ 370, 0 ≤ ci, j ≤ 255.

Sample tests

No.Sample inputSample output
1
2
0 0
2 3
1 1 1
2
4
1 0 0 0
1 2 5 2
1 0 0 0
4 4 4 4
1 2 3


View Problem Statistics Submit Author/source:
Problems from Contests / VoSTU Selection Rounds / Selection Round on ACM ICPC 2007 /
414. Shortest Expression 412.
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 0.094 sec.
© Copyright VSTU, AVT, Nosov D.A.