# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848611 | Darren0724 | Luxury burrow (IZhO13_burrow) | C++17 | 459 ms | 13912 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N=1005;
int v[N][N]{};
int a[N]{};
int cal(){
vector<int> st;
int ans=0;
for(int i=0;i<N;i++){
while(st.size()&&a[st.back()]>a[i]){
int k=a[st.back()];
st.pop_back();
int p=(st.size()?st.back()+1:0);
ans=max(ans,(i-p)*k);
}
st.push_back(i);
}
return ans;
}
int solve(int m){
int ans=0;
for(int j=0;j<N;j++){
a[j]=0;
}
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(v[i][j]>=m){
a[j]++;
}
else{
a[j]=0;
}
}
ans=max(ans,cal());
}
return ans;
}
int32_t main() {
int n,m,k;cin>>n>>m>>k;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>v[i][j];
}
}
int l=0,r=1e9+5;
while(r-l>1){
int mi=(l+r)>>1;
if(solve(mi)>=k){
l=mi;
}
else{
r=mi;
}
}
cout<<l<<' '<<solve(l)<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |