제출 #833282

#제출 시각아이디문제언어결과실행 시간메모리
833282vjudge1Bomb (IZhO17_bomb)C++17
24 / 100
81 ms6500 KiB
#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<m; i++){ bool counting=false; ll cnt=0; for(int j=0; j<n; 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 timeMemoryGrader output
Fetching results...