ヒストグラム中の最大長方形 (largest rectangle in a histogram)
(include/emthrm/dynamic_programming/largest_rectangle.hpp)
時間計算量
$O(N)$
仕様
名前 |
戻り値 |
template <typename T>
long long largest_rectangle(const std::vector<T>& height);
|
高さ $\mathrm{height}$ で表されるヒストグラム中の長方形の最大面積 |
参考文献
- https://ei1333.github.io/luzhiled/snippets/dp/largest-rectangle.html
TODO
- http://algorithms.blog55.fc2.com/blog-entry-133.html
- 最大正方形
- https://onlinejudge.u-aizu.ac.jp/problems/DPL_3_A
- 最大長方形
- https://onlinejudge.u-aizu.ac.jp/problems/DPL_3_B
Submissons
https://onlinejudge.u-aizu.ac.jp/solutions/problem/DPL_3_C/review/4082202/emthrm/C++14
Verified with
Code
Back to top page