제출 #936200

#제출 시각아이디문제언어결과실행 시간메모리
936200guagua0407Bomb (IZhO17_bomb)C++17
52 / 100
154 ms62476 KiB
#include <bits/stdc++.h> using namespace std; const int mxN=2500; int n, m, mxw=mxN, mxh=mxN, u[mxN][mxN], d[mxN][mxN], a[mxN], ans; string g[mxN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for(int i=0; i<n; ++i) { cin >> g[i]; for(int j=0, w=0; j<m; ++j) { w=g[i][j]&1?w+1:0; if(w&&(j+1>=m||g[i][j+1]&1^1)) mxw=min(w, mxw); } } for(int j=0; j<m; ++j) { for(int i=0, h=0; i<n; ++i) { h=g[i][j]&1?h+1:0; if(h&&(i+1>=n||g[i+1][j]&1^1)) mxh=min(h, mxh); u[i][j]=i&&g[i-1][j]&1?u[i-1][j]:i; } for(int i=n-1; ~i; --i) d[i][j]=i<n-1&&g[i+1][j]&1?d[i+1][j]:i; } for(int i=0; i<mxw; ++i) a[i]=mxh; auto c=[]() { for(int i=0; i<n; ++i) { for(int j=0; j<m; ++j) { if(j&&g[i][j-1]&1||g[i][j]&1^1) continue; for(int k=0, l=0, r=n; k<mxw; ++k) { l=max(u[i][j+k], l); r=min(d[i][j+k], r); a[k]=min(r-l+1, a[k]); } } } }; c(); for(int i=0; i<n; ++i) { reverse(g[i].begin(), g[i].end()); reverse(u[i], u[i]+m); reverse(d[i], d[i]+m); } //c(); for(int i=0; i<mxw; ++i) ans=max((i+1)*a[i], ans); cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

bomb.cpp: In function 'int main()':
bomb.cpp:17:28: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   17 |    if(w&&(j+1>=m||g[i][j+1]&1^1))
bomb.cpp:24:28: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   24 |    if(h&&(i+1>=n||g[i+1][j]&1^1))
bomb.cpp: In lambda function:
bomb.cpp:36:31: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   36 |     if(j&&g[i][j-1]&1||g[i][j]&1^1)
bomb.cpp:36:9: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   36 |     if(j&&g[i][j-1]&1||g[i][j]&1^1)
      |        ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...