제출 #170413

#제출 시각아이디문제언어결과실행 시간메모리
170413davitmargBomb (IZhO17_bomb)C++17
38 / 100
551 ms55748 KiB
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <queue> #include <iomanip> #include <bitset> #include <stack> #include <cassert> #include <iterator> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(), v.end() using namespace std; const int N = 2505; int n, m, a[N][N], nxt[N][N], d[N], Y, X, ans; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { char x; scanf(" %c", &x); a[i][j] += (x - '0'); } X = m; Y = n; for (int i = 1; i <= n; i++) for (int j = m; j >= 1; j--) { if (a[i][j]) nxt[i][j] = nxt[i][j + 1] + 1; else nxt[i][j] = 0; if (a[i][j - 1] == 0 && a[i][j]) X = min(X, nxt[i][j]); } for (int j = 1; j <= m; j++) { int y = 0; for (int i = 1; i <= n; i++) { if (a[i][j]) y++; else y = 0; if (a[i][j] && a[i + 1][j] == 0) Y = min(y, Y); } } for (int i = 1; i <= n; i++) d[i] = X; for (int j = 1; j <= m; j++) { int y = 0, x = X; for (int i = 1; i <= n; i++) { if (a[i][j] == 0 || (a[i][j - 1] == 1 && y == 0)) { y = 0; x = X; } else { y++; x = min(x, nxt[i][j]); d[y] = min(x, d[y]); } //cout << i << " : " << j << " = " << y << " : " << x << endl; } } for (int i = 1; i <= Y; i++) ans = max(ans, i * d[i]); cout << ans << endl; return 0; } /* 6 6 000111 000111 001111 111100 111000 111000 */

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

bomb.cpp: In function 'int main()':
bomb.cpp:38:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %c", &x);
             ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...