HBC51562SpicyRestaurant,思维Distance题解

一点都不欢乐 算法基础篇 57 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Gromah and LZR have entered the fourth level. There is a blank cube with sizen×m×hntimes mtimes hn×m×h hanging on the wall. Gromah soon finds a list beside the cube, there areqq_{}q instructions in the list and each instruction is in one of the following two formats: 1. _{}, meaning to add a tag on position_{} in the cube 2. _{}, meaning to determine the minimum Manhattan Distance to the given position _{}among all tagged positions Manhattan Distance between two positions,, , is defined as ∣x1x2∣+∣y1y2∣+∣z1z2∣|x_1 - x_2| + |y_1 - y_2| + |z_1 - z_2|∣x1x2∣+∣y1y2∣+∣z1z2∣. LZR also finds a note board saying that the password of this level is the sequence made up of all results of the instructions in format 2. Please help them get all results of the instructions in format 2.

Gromah and LZR have entered the fourth level. There is a blank cube with size n×m×hntimes mtimes hn×m×h hanging on the wall. Gromah soon finds a list beside the cube, there are qq_{}q​ instructions in the list and each instruction is in one of the following two formats: 1. (1,x,y,z)(1, x, y, z)_{}(1,x,y,z)​, meaning to add a tag on position (x,y,z)(x, y, z)_{}(x,y,z)​ in the cube 2. (2,x,y,z)(2,x, y, z)_{}(2,x,y,z)​, meaning to determine the minimum Manhattan Distance to the given position (x,y,z)(x, y, z)_{}(x,y,z)​ among all tagged positions Manhattan Distance between two positions (x1,y1,z1),(x2,y2,z2)(x_1, y_1, z_1), (x_2, y_2, z_2)(x1​,y1​,z1​),(x2​,y2​,z2​) is defined as ∣x1−x2∣+∣y1−y2∣+∣z1−z2∣|x_1 - x_2| + |y_1 - y_2| + |z_1 - z_2|∣x1​−x2​∣+∣y1​−y2​∣+∣z1​−z2​∣. LZR also finds a note board saying that the password of this level is the sequence made up of all results of the instructions in format 2. Please help them get all results of the instructions in format 2.

HBC51562SpicyRestaurant,思维Distance题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC51562SpicyRestaurant 思维Distance题解