제출 #99836

#제출 시각아이디문제언어결과실행 시간메모리
99836naoaiBomb (IZhO17_bomb)C++14
24 / 100
113 ms19044 KiB
#include <bits/stdc++.h> using namespace std; #define fin cin #define fout cout //ifstream fin("x.in"); ofstream fout("x.out"); const int nmax = 2500 + 5; string s[nmax + 1]; int main() { fin.sync_with_stdio(false); fin.tie(); fout.tie(); int n, m; fin >> n >> m; int hmax = n + 1; int wmax = m + 1; for (int i = 1; i <= n; ++ i) fin >> s[i]; for (int i = 1; i <= n; ++ i) { int a = 0; s[i] += '0'; for (int j = 0; j <= m; ++ j) { if (j > 0) if (s[i][j] == '0' && s[i][j - 1] == '1') wmax = min(wmax, a); if (s[i][j] == '1') ++ a; else a = 0; } } s[n + 1].resize(m + 1, '0'); for (int j = 0; j < m; ++ j) { int a = 0; for (int i = 1; i <= n + 1; ++ i) { if (i > 1) if (s[i][j] == '0' && s[i - 1][j] == '1') hmax = min(hmax, a); if (s[i][j] == '1') ++ a; else a = 0; } } cout << wmax * hmax << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...