# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833252 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 80 ms | 6560 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;
#define ll long long
#define pll pair<long long, long long>
#define pii pair<int,int>
#define fi first
#define se second
const ll MOD=1e9+7;
int n, m;
ll shortRow=MOD, shortCol=MOD;
char arr[2501][2501];
void solve(){
cin >> n >> m;
for(int i=0; i<n; i++){
bool counting=false;
ll cnt=0;
for(int j=0; j<m; j++){
cin >> arr[i][j];
if(arr[i][j]=='1'){
counting=true;
cnt++;
}
if(arr[i][j]=='0' && counting){
counting=false;
shortRow=min(shortRow,cnt);
cnt=0;
}
}
if(cnt!=0) shortRow=min(shortRow,cnt);
}
for(int i=0; i<n; i++){
bool counting=false;
ll cnt=0;
for(int j=0; j<m; j++){
if(arr[j][i]=='1'){
counting=true;
cnt++;
}
if(arr[j][i]=='0' && counting){
counting=false;
shortCol=min(shortCol,cnt);
cnt=0;
}
}
if(cnt!=0) shortCol=min(shortCol,cnt);
}
if(shortRow==MOD && shortCol==MOD){
shortRow=0;
shortCol=0;
}
cout << shortCol*shortRow << endl;
return;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int q=1;
for(int i=0; i<q; i++){
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |