제출 #93211

#제출 시각아이디문제언어결과실행 시간메모리
93211VardanyanBomb (IZhO17_bomb)C++14
43 / 100
297 ms105224 KiB
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> #include <bitset> #include <cstring> #include <vector> using namespace std; const int N = 2505; int dzaxic[N][N]; int ajic[N][N]; int a[N][N]; int n, m; int M[N]; int mnw = 1000 * 1000 * 1000 + 5; int mnh = mnw; vector<pair<int, int> > v; void calc1(int i, int j,int pl){ int now = -1; for (int ii = i; ii <= n; ii+=pl){ if (now == -1 || ajic[ii][j] < now){ now = ajic[ii][j]; } now = min(now, mnw); if(pl == 1) v.push_back({ ii - i + 1, now }); else v.push_back({ i - ii + 1, now }); } } void calc2(int i, int j,int pl){ } int main(){ ios_base::sync_with_stdio(false); cin >> n >> m; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ char c; cin >> c; a[i][j] = c - '0'; } } for (int i = 1; i <= n; i++) { int now = 0; for (int j = 1; j <= m; j++){ if (a[i][j]){ now++; dzaxic[i][j] = now; } else{ if(now) mnw = min(mnw, now); now = 0; } } if (now) mnw = min(mnw, now); now = 0; for (int j = m; j >= 1; j--){ if (a[i][j]){ now++; ajic[i][j] = now; } else now = 0; } } for (int j = 1; j <= m; j++){ int now = 0; for (int i = 1; i <= n; i++){ if (a[i][j]){ now++; } else{ if(now) mnh = min(mnh, now); now = 0; } } if (now) mnh = min(mnh, now); } //cout << mnh << " " << mnw << endl; /*for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ cout <<ajic[i][j] << " "; } cout << endl; }*/ for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ if (a[i][j] == 1 && a[i - 1][j] == 0 && a[i][j - 1] == 0 && a[i - 1][j - 1] == 0){ int now = -1; //calc1(i, j, 1); for (int ii = i; ii <= n; ii++){ if (a[ii][j] == 0) break; if (now == -1 || ajic[ii][j] < now){ now = ajic[ii][j]; } now = min(now, mnw); v.push_back({ ii - i + 1, now }); } } if (a[i][j] == 1 && a[i][j - 1] == 0 && a[i + 1][j - 1] == 0 && a[i][j + 1] == 0){ int now = -1; //calc1(i, j, -1); for (int ii = i; ii >= 1; ii--){ if (a[ii][j] == 0) break; if (now == -1 || ajic[ii][j] < now){ now = ajic[ii][j]; } now = min(now, mnw); v.push_back({ i - ii + 1, now }); } } if (a[i][j] == 1 && a[i - 1][j] == 0 && a[i][j + 1] == 0 && a[i - 1][j + 1] == 0){ int now = -1; for (int ii = i; ii <= n; ii++){ if (a[ii][j] == 0) break; if (now == -1 || dzaxic[i][j] < now){ now = dzaxic[i][j]; } now = min(now, mnw); v.push_back({ ii - i + 1, now }); } } if (a[i][j] == 1 && a[i + 1][j] == 0 && a[i][j + 1] == 0 && a[i + 1][j + 1] == 0){ int now = -1; for (int ii = i; ii >= 1; ii--){ if (a[ii][j] == 0) break; if (now == -1 || dzaxic[ii][j] < now){ now = dzaxic[ii][j]; } now = min(now, mnw); v.push_back({ i - ii + 1, now }); } } } } //cout << mnh << " " << mnw << endl; memset(M, -1, sizeof M); for (int i = 0; i < v.size(); i++){ int a = v[i].first; int b = v[i].second; if (M[a] == -1 || M[a] > b){ M[a] = b; } } long long ans = 0; for (int i = 0; i < v.size(); i++){ long long a = v[i].first; if (a > mnh) continue; long long b = M[a]; a *= b; ans = max(ans, a); } cout << ans << endl; return 0; }

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

bomb.cpp: In function 'int main()':
bomb.cpp:51:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(now) mnw = min(mnw, now);
    ^~
bomb.cpp:52:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     now = 0;
     ^~~
bomb.cpp:72:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(now) mnh = min(mnh, now);
    ^~
bomb.cpp:73:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     now = 0;
     ^~~
bomb.cpp:137:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < v.size(); i++){
                  ~~^~~~~~~~~~
bomb.cpp:145:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < v.size(); i++){
                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...