PivotOJ

King of the Hill

시간 제한: 5000ms메모리 제한: 1024MB출처: BAPC 2023BOJ 30499

문제

The king of Belle Aire People's Country has come up with a new plan: he has heard about the popular phenomenon called "King of the Hill", and he would like to become one as well. To do so, he has ordered you to raise a flag on the highest hill in his square kingdom, which has dimensions n×nn \times n. You are given a very expensive (it is gold- and jewel-embedded) satellite-based height-measuring system. This equipment is highly accurate: the heights on every location in the kingdom are represented with distinct integers. However, to cut costs, you are only allowed to take 10n+10010n+100 measurements before reporting back to the king.

Furthermore, you know for certain that there is only a single point that is the absolute highest: this is the only point for which its height is larger than the (up to) four orthogonally adjacent points that lie inside the kingdom. In other words, there are no local maxima besides the global maximum.

예제

예제 1

입력
3

3

9

4

8

7
출력
? 2 1

? 2 2

? 2 3

? 3 2

? 1 2

! 9

예제 2

입력
4

600000000

864213579

864297531

987654321

123456789

975318642
출력
? 3 3

? 2 3

? 2 2

? 1 2

? 1 1

? 1 3

! 987654321
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.