# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
343395 | ivan_tudor | Bomb (IZhO17_bomb) | C++14 | 51 ms | 8044 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 2505;
char mat[N][N];
int main()
{
//freopen(".in","r",stdin);
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int n, m;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin.getline(mat[i] + 1, N);
}
int l = INT_MAX, h = INT_MAX;
for(int i=1;i<=n;i++){
int cur = 0;
for(int j =1; j<=m;j++){
if(mat[i][j] == '1')
cur++;
if((mat[i][j] == '0' && mat[i][j-1] == '1') || (j == m && mat[i][j] == '1')){
l = min(l, cur);
cur = 0;
}
}
}
for(int i=1;i<=m;i++){
int cur = 0;
for(int j =1; j<=n;j++){
if(mat[j][i] == '1')
cur++;
if((mat[j][i] == '0' && mat[j - 1][i] == '1') || (j == n && mat[j][i] == '1')){
h = min(h, cur);
cur = 0;
}
}
}
cout<<l * h;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |