HBC245409文艺平衡树,数据结构,平衡树Lego题解

惰性的成熟 算法基础篇 54 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Wings loves playing Lego!

Wings loves playing Lego! Today, Wings is playing a strange set of Lego blocks. There are n symmetrical elongated blocks in this set. For some blocks, the number of bottom slots is not equal to the number of top slots. The picture below shows examples of such blocks. Wings sorts these blocks so that the number of bottom slots is in non-decreasing order and numbers them from 1 to n. He also notices that the number of top slots is in non-increasing order. Wings wants to pick m blocks for his building. He fifirst picks the block p1, places it on the table. In the following time, he picks the block pi (pi > pi−1), and puts it on block pi−1. Wings can assemble two blocks horizontally or vertically. The picture below shows all the different ways of assembling two certain blocks. Note that even the fifirst can be rotated to get the third, but the whole stack may not be symmetric, so we consider it to be assembled differently. The same goes for the fourth and seventh, and the fififth and sixth. However, when Wings picks one block, and there are k different ways of assembling, it will take him k seconds to decide how to assemble. Wings wants to know the earliest time he can complete his building.

HBC245409文艺平衡树,数据结构,平衡树Lego题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC245409文艺平衡树 数据结构 平衡树Lego题解