시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 256 MB83240.000%

문제

A square wall with size N x N is build up by N2 /2 bricks, all close fitting to each other (N is an even number). Each brick has size 2 x 1. The bricks are numbered from 1 to N2 /2. A part of the bricks are positioned horizontally and the rest of the bricks are positioned vertically. There are no holes in the wall. On the example given below, each pair of squares with same numbers in both squares represents one brick.

We need to make a square hole in the wall in order to fit a window. The hole must meet the following requirements:

  1. Its borders should be parallel to the borders of the wall;
  2. The hole must not touch any of the borders of the wall (means the hole must be totally “inside” the wall);
  3. When making the hole no brick should be broken (so the borders of the hole must pass only on borders of the bricks).

Write program window which determines the maximal possible square hole (i.e. square with maximal side), which meets the given requirements. It is guaranteed that at least one such hole exists.

입력

A single positive integer N is given on the first row of the standard input – dimension of wall’s side. Following are N rows with N integers in each one, which describes the brick configuration of the wall.

출력

On a single row of the standard output print three integers separated by interval – side length of the maximal square hole, and row and column number of the upper-left corner (we assume that the upperleft position of the entire wall has coordinates 1,1). If more than one solution exists, the program has to output only one solution, which may be any possible.

서브태스크

번호배점제한
115

4 ≤ N ≤ 100

235

100 < N ≤ 1000

350

1000 < N ≤ 2000

예제 입력 1

6
1 1 4 4 13 14
2 3 3 5 13 14
2 6 7 5 12 12
9 6 7 10 10 15
9 8 8 11 11 15
16 16 17 17 18 18

예제 출력 1

2 3 2

힌트

The maximal square hole has side 2. It is possible to make it in two ways: either by removing bricks with numbers 6 and 7, or by removing bricks with numbers 10 and 11.

채점 및 기타 정보

  • 예제는 채점하지 않는다.