Submission #93322

#TimeUsernameProblemLanguageResultExecution timeMemory
93322toloraiaBomb (IZhO17_bomb)C++14
34 / 100
1099 ms57752 KiB
#include <bits/stdc++.h> #define ll long long #define F first #define S second #pragma GCC ("O3") using namespace std; const int N = 2600; int n, m; char ch[N][N]; int A[N][N], B[N][N]; int main() { ios::sync_with_stdio(false); cin>>n>>m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin>>ch[i][j]; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) A[i][j] = A[i - 1][j] + A[i][j - 1] - A[i - 1][j - 1] + ch[i][j] - '0'; int J = m; int ans = 0; for (int I = 1; I <= n && I * J >= ans; I++){ while (J){ bool ok = 1; for (int i = 0; i <= n; i++) for (int j = 0; j <= m; j++) B[i][j] = 0; for (int i = 0; i + I <= n; i++) for (int j = 0; j + J <= m; j++){ int x = A[i + I][j + J] - A[i + I][j] - A[i][j + J] + A[i][j]; if (x == I * J){ B[i + I + 1][j + J + 1]++; B[i + 1][j + J + 1]--; B[i + I + 1][j + 1]--; B[i + 1][j + 1]++; } } for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) B[i][j] += B[i - 1][j] + B[i][j - 1] - B[i - 1][j - 1]; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (ch[i][j] == '1' && B[i][j] == 0) ok = 0; if (ok) break; J--; } ans = max (ans, I * J); } cout<<ans<<endl; return 0; }

Compilation message (stderr)

bomb.cpp:5:0: warning: ignoring #pragma GCC  [-Wunknown-pragmas]
 #pragma GCC ("O3")
#Verdict Execution timeMemoryGrader output
Fetching results...