Submission #1128761

#TimeUsernameProblemLanguageResultExecution timeMemory
1128761_TemirhanBomb (IZhO17_bomb)C++20
24 / 100
29 ms6724 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define sz(x) x.size() #define F first #define S second #define nl '\n' void Tima() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const int N = 3000; const int inf = 1e12; const int mod = 1e9 + 7; int n, m; string t[N]; signed main() { // Tima(); ios_base::sync_with_stdio(0); cin.tie(0); cin >>n >>m; for( int i = 1; i <= n; ++i ) { cin >>t[i]; t[i] = "0" + t[i]; } int mnh = inf, mnv = inf; for( int i = 1; i <= n; ++i ) for( int j = 1; j <= m; ++j ) { if( t[i][j] == '0' ) continue; int j1 = j; while( j1 < m && t[i][j1 + 1] == '1' ) ++j1; mnh = min(mnh, j1 - j + 1); j = j1; } if( mnh == inf ) mnh = 1; for( int j = 1; j <= m; ++j ) for( int i = 1; i <= n; ++i ) { if( t[i][j] == '0' ) continue; int i1 = i; while( i1 < n && t[i1 + 1][j] == '1' ) ++i1; mnv = min(mnv, i1 - i + 1); i = i1; } if( mnv == inf ) mnv = 1; cout <<mnh * mnv; }

Compilation message (stderr)

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