Submission #170227

#TimeUsernameProblemLanguageResultExecution timeMemory
170227nvmdavaBomb (IZhO17_bomb)C++17
24 / 100
135 ms6648 KiB
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("fma,avx2") using namespace std; #define ll long long #define ff first #define ss second mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define INF 0x3f3f3f3f #define MOD 1000000007 #define N 2505 char c[N][N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin>>n>>m; memset(c, '0', sizeof c); for(int i = 1; i <= n; ++i){ for(int j = 1; j <= m; ++j){ cin>>c[i][j]; } } int w = 2500, h = 2500; for(int i = 1; i <= n; i++){ int th = 0; for(int j = 1; j <= m + 1; ++j){ if(c[i][j] == '0' && c[i][j - 1] == '1'){ h = min(th, h); th = 0; } else if(c[i][j] == '1'){ ++th; } } } for(int i = 1; i <= m; i++){ int tw = 0; for(int j = 1; j <= n + 1; ++j){ if(c[j][i] == '0' && c[j - 1][i] == '1'){ w = min(tw, w); tw = 0; } else if(c[j][i] == '1'){ ++tw; } } } cout<<w * h; }
#Verdict Execution timeMemoryGrader output
Fetching results...