|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|7 초||512 MB||306||89||67||25.769%|
The Chilean Andes have become increasingly popular as a destination for backpacking and hiking. Many parts of the Andes are quite remote and thus dangerous. Because of this, the Ministry of Tourism wants to help travelers plan their trips. In particular, the travelers need to know how high they will have to climb during their journey, as this information will help them decide which equipment they need to bring. The Ministry has tasked you to provide the aspiring mountaineers with this data.
You are given a topographic map of a part of the Andes, represented as a two-dimensional grid of height values, as well as the list of origins and destinations. Mountaineers can move from each grid cell to any of the four adjacent cells. For each mountaineer find the minimal height that they must be able to reach in order to complete their journey
The input consists of:
The top left cell of the grid has coordinates (1, 1) and the bottom right cell has coordinates (m, n).
Output q integers, the minimal height for each mountaineer, in the same order as in the input.
3 5 3 1 3 2 1 3 2 4 5 4 4 2 1 3 2 2 1 1 3 2 2 4 2 2 1 4 3 4
2 4 3