Submission #107729

#TimeUsernameProblemLanguageResultExecution timeMemory
107729Shafin666Bomb (IZhO17_bomb)C++14
24 / 100
476 ms12792 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define pii pair<int, int> #define read_input freopen("in.txt","r", stdin) #define print_output freopen("out.txt","w", stdout) typedef long long ll; typedef long double ld; using namespace std; int main() { int n, m; char grid[2505][2505]; cin >> n >> m; int w = 1e9+7, h = 1e9+7; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { cin >> grid[i][j]; } } for(int i = 1; i <= n; i++) { int len = 0; for(int j = 1; j <= m; j++) { if(grid[i][j] == '1') len += 1; else { if(len) w = min(w, len); len = 0; } } if(len) w = min(w, len); } for(int i = 1; i <= m; i++) { int len = 0; for(int j = 1; j <= n; j++) { if(grid[j][i] == '1') len += 1; else { if(len) h = min(h, len); len = 0; } } if(len) h = min(h, len); } cout << w * h << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...