| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 47579 | dqhungdl | 호화 벙커 (IZhO13_burrow) | C++17 | 569 ms | 4732 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int m,n,k,L[1005],R[1005],h[1005],a[1005][1005];
int Check(int lim)
{
for(int i=1;i<=n;i++)
h[i]=0;
int maxn=0;
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
if(a[i][j]>=lim)
h[j]++;
else
h[j]=0;
for(int j=1;j<=n;j++)
{
L[j]=j;
int tmp=j-1;
while(tmp>0&&h[j]<=h[tmp])
{
L[j]=L[tmp];
tmp=L[tmp]-1;
}
}
for(int j=n;j>=1;j--)
{
R[j]=j;
int tmp=j+1;
while(tmp<=n&&h[j]<=h[tmp])
{
R[j]=R[tmp];
tmp=R[tmp]+1;
}
}
for(int j=1;j<=n;j++)
maxn=max(maxn,h[j]*(R[j]-L[j]+1));
}
return maxn;
}
int main()
{
ios_base::sync_with_stdio(false);
//freopen("TEST.INP","r",stdin);
//freopen("TEST.OUT","w",stdout);
cin>>m>>n>>k;
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
cin>>a[i][j];
int area,rs,l=1,r=1e9;
while(l<=r)
{
int mid=(l+r)/2;
int tmp=Check(mid);
if(tmp>=k)
{
area=tmp;
rs=mid;
l=mid+1;
}
else
r=mid-1;
}
cout<<rs<<' '<<area;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
