# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833204 | vjudge1 | Bomb (IZhO17_bomb) | C++14 | 33 ms | 6572 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, minh = 69420, minw = 69420, urutan;
string s;
vector<string> grid;
cin >> n >> m;
for(int i = 0; i < n; i++){
cin >> s;
grid.push_back(s);
}
for(int i = 0; i < n; i++){
urutan = 0;
for(int j = 0; j < m; j++){
if(grid[i][j] == '1'){
urutan++;
}
else{
if(urutan != 0){
minw = min(urutan, minw);
}
urutan = 0;
}
}
if(urutan != 0){
minw = min(urutan, minw);
}
}
if(urutan != 0){
minw = min(urutan, minw);
}
for(int i = 0; i < m; i++){
urutan = 0;
for(int j = 0; j < n; j++){
if(grid[j][i] == '1'){
urutan++;
}
else{
if(urutan != 0){
minh = min(urutan, minh);
}
urutan = 0;
}
}
if(urutan != 0){
minh = min(urutan, minh);
}
}
if(urutan != 0){
minh = min(urutan, minh);
}
if(minh == 69420 || minw == 69420){
cout << 0 << endl;
}
//cout << minh << " " << minw << endl;
cout << minh*minw;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |