Submission #848608

#TimeUsernameProblemLanguageResultExecution timeMemory
848608Darren0724Luxury burrow (IZhO13_burrow)C++17
0 / 100
110 ms544 KiB
#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]){ ans=max(ans,(i-st.back())*a[st.back()]); st.pop_back(); } 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 timeMemoryGrader output
Fetching results...