HBC25031遥远的记忆,思维[USACO 2007 Dec S]Mud Puddles题解

凸凸曼凸凸 算法基础篇 52 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
Farmer John is leaving his house promptly at 6 AM for his daily milking of Bessie. However, the previous evening saw a heavy rain, and the fields are quite muddy. FJ starts at the point in the coordinate plane and heads toward Bessie who is located at . He can see all N puddles of mud, located at points on the field. Each puddle occupies only the point it is on.Having just bought new boots, Farmer John absolutely does not want to dirty them by stepping in a puddle, but he also wants to get to Bessie as quickly as possible. He's already late because he had to count all the puddles. If Farmer John can only travel parallel to the axes and turn at points with integer coordinates, what is the shortest distance he must travel to reach Bessie and keep his boots clean?There will always be a path without mud that Farmer John can take to reach Bessie.

Farmer John is leaving his house promptly at 6 AM for his daily milking of Bessie. However, the previous evening saw a heavy rain, and the fields are quite muddy. FJ starts at the point (0, 0) in the coordinate plane and heads toward Bessie who is located at (X, Y) (-500 ≤ X ≤ 500; -500 ≤ Y ≤ 500). He can see all N (1 ≤ N ≤ 10,000) puddles of mud, located at points (Ai, Bi) (-500 ≤ Ai ≤ 500; -500 ≤ Bi ≤ 500) on the field. Each puddle occupies only the point it is on. Having just bought new boots, Farmer John absolutely does not want to dirty them by stepping in a puddle, but he also wants to get to Bessie as quickly as possible. He's already late because he had to count all the puddles. If Farmer John can only travel parallel to the axes and turn at points with integer coordinates, what is the shortest distance he must travel to reach Bessie and keep his boots clean? There will always be a path without mud that Farmer John can take to reach Bessie.

HBC25031遥远的记忆,思维[USACO 2007 Dec S]Mud Puddles题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC25031遥远的记忆 思维[USACO 2007 Dec S]Mud Puddles题解