intsolute(vector<int>&heights){ int ret = 0; vector<int>v; heights.push_back(0); for (int i = 0; i < heights.size(); i++) { while (v.size() && heights[v.back()] >= heights[i]) { int h = heights[v.back()]; v.pop_back(); int l = v.empty() ? -1 : v.back(); ret = max(ret, h*(i - l - 1)); } v.push_back(i); } return ret; }