mmrz's library

This documentation is automatically generated by online-judge-tools/verification-helper


Project maintained by mm-rz Hosted on GitHub Pages — Theme by mattgraham

:warning: z_other/maximum_rect.cpp

Code

#include "bits/stdc++.h"
using namespace std;

using ll = long long;

ll maximum_rect(vector<ll> a){
	int n = (int)a.size();
	vector<ll> l(n), r(n);
	{
		stack<ll> st;
		for(int i = 0;i < n;i++){
			while(not st.empty() && a[st.top()] >= a[i])st.pop();
			l[i] = (st.empty() ? 0 : st.top() + 1);
			st.push(i);
		}
	}
	{
		stack<ll> st;
		for(int i = n - 1;i >= 0;i--){
			while(not st.empty() && a[st.top()] >= a[i])st.pop();
			r[i] = (st.empty() ? n : st.top());
			st.push(i);
		}
	}
	ll ans = 0;
	for(int i = 0;i < n;i++)ans = max(ans, a[i] * (r[i] - l[i]));
	return ans;
}
Traceback (most recent call last):
  File "/home/runner/work/_tool/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/_tool/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/home/runner/work/_tool/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/_tool/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 260, in _resolve
    raise BundleErrorAt(path, -1, "no such header")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: bits/stdc++.h: line -1: no such header
Back to top page