# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
42306 | wilwxk | 호화 벙커 (IZhO13_burrow) | C++14 | 695 ms | 54624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e3+3;
int ori[MAXN][MAXN];
int h[MAXN][MAXN];
int ent[MAXN];
stack<int> st, sti;
int xx, yy, x, respf, maior;
int testa(int k) {
for(int i=1; i<=xx; i++) {
for(int j=1; j<=yy; j++) {
if(ori[i][j]>=k) h[i][j]=1; else h[i][j]=0;
if(h[i][j]==1) h[i][j]=h[i-1][j]+1; else h[i][j]=0;
}
}
int resp=0;
for(int i=1; i<=xx; i++) {
while(st.size()) { st.pop(); sti.pop(); } ent[0]=0; st.push(-2); sti.push(0);
for(int j=1; j<=yy+1; j++) {
int cur=h[i][j]; if(j==yy+1) cur=-1;
while(st.top()>=cur) {
int area=st.top()*(j-ent[sti.top()]);
resp=max(resp, area);
st.pop(); sti.pop();
}
ent[j]=sti.top(); ent[j]++;
st.push(h[i][j]); sti.push(j);
}
}
//printf("%d : %d\n", k, resp);
if(resp>=x) return resp;
else return -1;
}
int main() {
scanf("%d %d %d", &xx, &yy, &x);
for(int i=1; i<=xx; i++) {
for(int j=1; j<=yy; j++) {
scanf("%d", &ori[i][j]); maior=max(maior, ori[i][j]);
}
}
respf=0;
for(int i=maior; i>=1; i/=2) {
while(testa(respf+i)!=-1) respf+=i;
}
printf("%d %d\n", respf, testa(respf));
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |