HBC52172面基,图论,最短路,枚举,离散化Cutting Bamboos题解

冷夕颜 算法基础篇 38 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
You are given q queries of the type . For each query we consider only the l-th to r-th bamboo inclusive. We want to make y horizontal cuts through these bamboos, such that after each cut, the total length of bamboo cut is the same, and after all y cuts there is no bamboo left. For example, if there are 3 bamboos of height 3, 4, 5 respectively and y = 4. The first cut should be at height 3, after which the heights of the bamboos are 3, 3, 3 respectively and the total amount of bamboo cut is 0 + 1 + 2 = 3. Then, the next 3 cuts should be at height 2, 1, 0 respectively. You want to find out what is the height the x-th cut is performed.Note that after each query, the bamboos are not actually cut, so the heights of the bamboos remain constant after each query.

There are n bamboos arranged in a line. The i-th bamboo from the left has height h_{i} h i ​ . You are given q queries of the type (l, r, x, y). For each query (l, r, x, y) we consider only the l-th to r-th bamboo inclusive. We want to make y horizontal cuts through these bamboos, such that after each cut, the total length of bamboo cut is the same, and after all y cuts there is no bamboo left. For example, if there are 3 bamboos of height 3, 4, 5 respectively and y = 4. The first cut should be at height 3, after which the heights of the bamboos are 3, 3, 3 respectively and the total amount of bamboo cut is 0 + 1 + 2 = 3. Then, the next 3 cuts should be at height 2, 1, 0 respectively. You want to find out what is the height the x-th cut is performed. Note that after each query, the bamboos are not actually cut, so the heights of the bamboos remain constant after each query.

HBC52172面基,图论,最短路,枚举,离散化Cutting Bamboos题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC52172面基 图论 最短路 枚举 离散化Cutting Bamboos题解