# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
920196 | MilosMilutinovic | Bomb (IZhO17_bomb) | C++14 | 1053 ms | 2904 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Online C++ compiler to run C++ program online
#include<bits/stdc++.h>
using namespace std;
int n,m;
char s[25][25];
bool was[25][25];
bool check(int x,int y){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
was[i][j]=false;
}
}
for(int i=0;i+x<=n;i++){
for(int j=0;j+y<=m;j++){
bool ok=true;
for(int a=i;a<i+x;a++){
for(int b=j;b<j+y;b++){
if(s[a][b]=='0') ok=false;
}
}
if(ok){
for(int a=i;a<i+x;a++){
for(int b=j;b<j+y;b++){
was[a][b]=true;
}
}
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(s[i][j]=='1'&&!was[i][j]){
return false;
}
}
}
return true;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++) scanf("%s",s[i]);
int ans=0;
for(int x=1;x<=n;x++){
for(int y=1;y<=m;y++){
if(check(x,y)) ans=max(ans,x*y);
}
}
printf("%d\n",ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |