问题描述:
英语翻译
However,for the gold version of the problem this is not enough.We'll use the same basic structure for the new solution but we'll be able to bring the runtime down to O(N log N) using two observations.
First,we can maintain which sections of the array correspond to different hmax terms (hmax from the solution above) efficiently as we iterate over the books.When we move past book i the set of positions with hmax H[i] is exactly those with hmax no larger than H[i] when we were at i-1.As hmax is non-increasing with j we can simply keep a list of the intervals of books with the same hmax and update the list by merging the intervals with hmax
不管你是机器翻译的还是人工的,请至少自己看懂……
However,for the gold version of the problem this is not enough.We'll use the same basic structure for the new solution but we'll be able to bring the runtime down to O(N log N) using two observations.
First,we can maintain which sections of the array correspond to different hmax terms (hmax from the solution above) efficiently as we iterate over the books.When we move past book i the set of positions with hmax H[i] is exactly those with hmax no larger than H[i] when we were at i-1.As hmax is non-increasing with j we can simply keep a list of the intervals of books with the same hmax and update the list by merging the intervals with hmax
不管你是机器翻译的还是人工的,请至少自己看懂……
问题解答:
我来补答展开全文阅读