# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
341116 | juggernaut | 호화 벙커 (IZhO13_burrow) | C++14 | 488 ms | 17900 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,m,k,a[1005][1005],lb=1,rb=1e9,mb,a2,a3,b[1005][1005],l[1005],r[1005];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>m>>k;
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)cin>>a[i][j];
while(lb<=rb) {
mb=(lb+rb)>>1,a3=0;
for(int i=n-1;i>=0;i--)
for(int j=0; j<m;j++)
b[i][j]=a[i][j]<mb?0:b[i+1][j]+1;
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
l[j]=j-1;
while(l[j]>=0&&b[i][l[j]]>=b[i][j])l[j]=l[l[j]];
}
for(int j=m-1;j>=0;j--) {
r[j]=j+1;
while(r[j]<m&&b[i][r[j]]>=b[i][j])r[j]=r[r[j]];
a3=max(b[i][j]*(r[j]-l[j]-1), a3);
}
}
if(a3>=k) {
lb=mb+1;
a2=a3;
} else
rb=mb-1;
}
cout<<rb<<" "<<a2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |