# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
682494 | HamletPetrosyan | Bomb (IZhO17_bomb) | C++17 | 432 ms | 6564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 2505, INF = 1e9 + 5;
int n, m;
bool a[N][N], found = false;
int w = INF, h = INF;
int main(){
cin >> n >> m;
char x;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> x;
a[i][j] = (x == '1');
found = found || (x == '1');
}
}
if(!found){
cout << n * m << "\n";
return 0;
}
int now = 0, np = INF;
for(int i = 0; i < n; i++){
now = 0;
for(int j = 0; j < m; j++){
if(!a[i][j]){
if(now) np = min(np, now);
now = 0;
}
else now++;
}
if(now) np = min(np, now);
}
w = np;
np = INF;
for(int i = 0; i < n; i++){
now = 0;
for(int j = 0; j < m; j++){
if(!a[j][i]){
if(now) np = min(np, now);
now = 0;
}
else now++;
}
if(now) np = min(np, now);
}
h = np;
cout << w * h << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |