제출 #1128454

#제출 시각아이디문제언어결과실행 시간메모리
1128454_TemirhanBomb (IZhO17_bomb)C++20
0 / 100
3 ms584 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, p[N][N], p1[N][N]; string t[N]; signed main() { Tima(); ios_base::sync_with_stdio(0); cin.tie(0); cin >>n >>m; for( int i = 0; i < n; ++i ) { cin >>t[i]; for( int j = 0; j < m; ++j ) if( t[i][j] == '1' ) ++p[i + 1][j + 1]; } for( int i = 1; i <= n; ++i ) for( int j = 1; j <= m; ++j ) p[i][j] += p[i - 1][j] + p[i][j - 1] - p[i - 1][j - 1]; int ans = 1; for( int x = 1; x <= n; ++x ) for( int y = 1; y <= m; ++y ) { if( x == 1 && y == 1 ) continue; for( int i = 1; i + x - 1 <= n; ++i ) for( int j = 1; j + y - 1 <= m; ++j ) if( p[i + x - 1][j + y - 1] - p[i + x - 1][j - 1] - p[i - 1][j + y - 1] + p[i - 1][j - 1] == x * y ) { ++p1[i][j]; --p1[i + x][j]; --p1[i][j + y]; ++p1[i + x][j + y]; } bool ch = true; for( int i = 1; i <= n; ++i ) for( int j = 1; j <= m; ++j ) { p1[i][j] += p1[i - 1][j] + p1[i][j - 1] - p1[i - 1][j - 1]; if( !p1[i][j] && t[i - 1][j - 1] == '1' ) ch = false; } if( ch ) ans = max(ans, x * y); for( int i = 1; i <= n + 1; ++i ) for( int j = 1; j <= m + 1; ++j ) p1[i][j] = 0; } cout <<ans; }

컴파일 시 표준 에러 (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...