Submission #343401

#TimeUsernameProblemLanguageResultExecution timeMemory
343401ivan_tudorBomb (IZhO17_bomb)C++14
24 / 100
50 ms6636 KiB
#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>>ws; 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 timeMemoryGrader output
Fetching results...