Bessie is trapped in a triangular maze with N rows (1
Bessie is trapped in a triangular maze with N rows (1 <= N <= 1,000,000). A three row maze is shown below: The i'th row of the maze contains 2*i-1 triangles. Numbering from the left, the triangles are named (i,1), (i,2), and so on. Bessie can travel to the (often three) triangles which share an edge with her current triangle. For example, if she is at (3, 3), she can travel to (3, 2), (3, 4) and (4, 4). Bessie takes one minute to travel from one triangle to the next. FJ has learned the Bessie is trapped and knows by tracking her iPhone that she starts her exit trek at triangle (Si,Sj). FJ's love for Bessie knows no bounds so he wants her back in the minimum possible time. The maze has M (1 <= M <= 10,000) exits found in locations throughout the set of triangles. Any one of these will enable Bessie to escape. Once she enters an exit triangle, she leaves the maze in just one more minute. Find the minimum time in minutes, T, required for Bessie to exit the maze and report the optimal exit location she uses, (OUTi, OUTj). If more than one location requires only T minutes, output the location with the smallest row. If two optimal rows are the same, output the one with smaller column.
![HBC24861B是不是太迟了,字符串,语言题[USACO 2009 Nov G]Cow Rescue题解
-第1张图片-东莞河马信息技术 HBC24861B是不是太迟了,字符串,语言题[USACO 2009 Nov G]Cow Rescue题解
-第1张图片-东莞河马信息技术](https://www.xxstcz.com/zb_users/upload/2023/11/20231118050602170025516260543.jpeg)