제출 #343261

#제출 시각아이디문제언어결과실행 시간메모리
343261PetyBomb (IZhO17_bomb)C++14
24 / 100
490 ms61732 KiB
#include <bits/stdc++.h> using namespace std; int n, m, w, h, dp[2502][2502], dp2[2502][2502]; char v[2502][2502]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { cin >> v[i][j]; if (v[i][j] == '1') { dp[i][j] = dp[i][j - 1] + 1; dp2[i][j] = dp2[i - 1][j] + 1; } } int w = 1e9, h = 1e9; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { if ((j == m && v[i][j] == '1') || (v[i][j] == '1' && v[i][j + 1] == '0')) w = min(w, dp[i][j]); if ((i == n && v[i][j] == '1') || (v[i][j] == '1' && v[i + 1][j] == '0')) h = min(h, dp2[i][j]); } cout << w * h << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...