Submission #1128777

#TimeUsernameProblemLanguageResultExecution timeMemory
1128777BilAktauAlmansurBomb (IZhO17_bomb)C++20
24 / 100
122 ms24984 KiB
#include <bits/stdc++.h> #pragma optimize("g", on) #pragma GCC optimize ("03") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native") void Freopen () { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } using namespace std; #define fi first #define se second // #define int long long const int N = 2500 + 7, M = 1e6 + 1, mod = 1e9 + 7; int n, m, c[N][N]; void solve() { cin>>n>>m; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { char s; cin>>s; c[i][j] = (s - '0'); } } int X = n + 1, Y = m + 1; for(int j = 1; j <= m; j++) { int cnt = 0; for(int i = 1; i <= n; i++) { if(c[i][j])cnt ++; else { if(c[i - 1][j])X = min(X, cnt); cnt = 0; } } if(c[n][j])X = min(X, cnt); } for(int i = 1; i <= n; i++) { int cnt = 0; for(int j = 1; j <= m; j++) { if(c[i][j])cnt ++; else { if(c[i][j - 1])Y = min(Y, cnt); cnt = 0; } } if(c[i][m])Y = min(Y, cnt); } cout << X * Y << '\n'; } signed main() { // freopen("duty.in", "r", stdin); // freopen("duty.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //Freopen(); int T = 1; // cin>>T; while(T --)solve(); }

Compilation message (stderr)

bomb.cpp: In function 'void Freopen()':
bomb.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bomb.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...